Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] 企业微信 access_token 缓存没有区分应用导致应用调用异常 #706

Open
johnpoint opened this issue Aug 15, 2023 · 6 comments
Labels

Comments

@johnpoint
Copy link
Contributor

描述

如何复现
步骤:
1、企业微信后台创建两个应用A、B
2、先使用 A 的配置进行API调用,此时行为正常
3、将配置替换为 B 的配置,此时发消息等API调用行为仍为B应用

原因
https://github.com/silenceper/wechat/blob/v2/credential/default_access_token.go#L201C31-L201C31
在这行缓存中,仅区分了 corp_id 而没有区分应用导致的

@johnpoint
Copy link
Contributor Author

#536

@johnpoint johnpoint reopened this Aug 15, 2023
@johnpoint
Copy link
Contributor Author

是否应该引入 agent_id 进行应用级别的隔离?

@wwek
Copy link

wwek commented Jan 9, 2024

是否应该引入 agent_id 进行应用级别的隔离?

我也遇到这个问题。

@wwek
Copy link

wwek commented Jan 9, 2024

accessToken 同企业下不同应用是不一样的
所以NewWorkAccessToken 需要默认 corpid + appid 隔离

@wwek
Copy link

wwek commented Jan 29, 2024

是否应该引入 agent_id 进行应用级别的隔离?

应该引入,因为企业微信应用的accessToken本身就是按照 agent_id隔离的
也就是说对于企业微信应用来说需要
企业微信+corpid+agentid 组合为缓存key
现在的缓存key仅仅是 企业微信+corpid

@houseme
Copy link
Collaborator

houseme commented Jan 29, 2024

是否应该引入 agent_id 进行应用级别的隔离?

应该引入,因为企业微信应用的accessToken本身就是按照 agent_id隔离的 也就是说对于企业微信应用来说需要 企业微信+corpid+agentid 组合为缓存key 现在的缓存key仅仅是 企业微信+corpid

@wwek 欢迎搞个pr修复改进

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants