androidauthenticationwechatwechat-auth

WeChat SendAuth request for access token code only works once


I am following the WeChat Login documentation for Android and it works but only once and I can't repeat the process.

I use this code to get the access token code:

IWXAPI api = WXAPIFactory.createWXAPI(this, APP_ID, false);
SendAuth.Req request = new SendAuth.Req();
request.scope = "snsapi_userinfo";
request.state = "wechat_sdk_demo_test";
api.sendReq(request);

I have created the WXEntryActivty and I received the response from the WeChat app and I can finish the login process.

But if I reinstall my app and try to login with WeChat again I always get ERR_BAN (-6) error code. To make it work again I have to reinstall the WeChat app.

I could't find anything about when can I get ERR_BAN error code in the documentation. Can anyone help me with this problem?


Solution

  • I managed to solve the problem. I copied the MD5 signature directly from the keytool's output which is contains colons :. I removed the colons from the signature and now it works correctly.

    I think this is a bug in the WeChat app because the signature works with colons when the app displays the authorization page but not after that.