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

[咨询] 使用微信小程序接口时 怎么 指定使用 StableAccessToken 这个获取token #675

Open
dzwvip opened this issue May 9, 2023 · 1 comment
Labels

Comments

@dzwvip
Copy link

dzwvip commented May 9, 2023

请描述您的问题
我看最新版里增加了这个稳定版的token,,但是不知道在 使用微信小程序接口时 怎么 指定使用 这个StableAccessToken 新增的稳定版token

@dzwvip dzwvip added the question label May 9, 2023
@ccfish86
Copy link
Contributor

虽然说不是很方便吧,但也不是不能指定。

	// 小程序
	miniProgramConfig := &miniProgramConfig.Config{
		AppID:          CONFIG.Wechat.MpAppID,
		AppSecret:      CONFIG.Wechat.MpAppSecret,
		Token:         CONFIG.Wechat.CallbackToken,
		EncodingAESKey: CONFIG.Wechat.CallbackAesKey,
		Cache:          redisCache,
	}

	WxMiniProgram = Wechat.GetMiniProgram(miniProgramConfig)
	WxMiniProgram.SetAccessTokenHandle(credential.NewStableAccessToken(CONFIG.Wechat.MpAppID,
		CONFIG.Wechat.MpAppSecret, credential.CacheKeyMiniProgramPrefix, redisCache))

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

2 participants