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

解密手机号接口报错 #65

Open
EthanChenLi opened this issue Sep 23, 2021 · 8 comments
Open

解密手机号接口报错 #65

EthanChenLi opened this issue Sep 23, 2021 · 8 comments

Comments

@EthanChenLi
Copy link

操作系统:win10
golang版本:1.14.1

正确传入 sessionkey , encrypted_data,iv 返回以下内容

invalid character '¶' looking for beginning of value
@royalrick
Copy link
Owner

先调用登陆接口,再进行解密操作。顺序反过来就会报错;

@EthanChenLi
Copy link
Author

另外微信解密用户信息似乎不再返回openid了(官方文档也提示不返回了)。 DecryptUserInfo() 该方法的openid应该是拿不到了

@royalrick
Copy link
Owner

image
看了下文档,仍然包含呢;

@JiajunDou
Copy link

/root/go/pkg/mod/github.com/medivhzhan/weapp/v3@v3.3.3/encrypt/cbc.go:59 (0x6dc044)
(*CBC).Decrypt: cbc.iv = cbc.iv[:size]
/root/go/pkg/mod/github.com/medivhzhan/weapp/v3@v3.3.3/decrypt.go:28 (0x6dc88e)
(*Client).DecryptUserData: return encrypt.NewCBC(rawIV, key, cipher).Decrypt()
/root/go/pkg/mod/github.com/medivhzhan/weapp/v3@v3.3.3/decrypt.go:50 (0x6dc951)
(*Client).DecryptMobile: raw, err := cli.DecryptUserData(sessionKey, encryptedData, iv)

生产环境中将近1/4报这个错 这个是什么原因?

getUserInfo已经被抛弃了 你手册没有仔细看

@royalrick
Copy link
Owner

报错的原因就是因为你先调用的获取手机号,再对用用户调用的登陆接口。顺序反了;

@royalrick
Copy link
Owner

getUserInfo确实被取消了

@voidint
Copy link

voidint commented Dec 15, 2021

官方文档中描述的获取手机号的接口发生了变化,目前的sdk好像没法拿到这个信息了。

@royalrick
Copy link
Owner

@voidint 新版本v3.6.3已经增加,使用方式: cli.NewPhonenumber().GetPhoneNumber

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

No branches or pull requests

4 participants