Wechat Social Login error: "Oops Something went wrong :("

1.4k Views Asked by At

I am trying to integrate wechat social login to my website, but I am not sure why it is not working.

When I access the URL on the browser, it appear the following screen enter image description here

What I'm expecting: enter image description here

Here is the url I'm trying to access:

https://open.weixin.qq.com/connect/qrconnect?appid=wx**************ec&redirect_uri=http%3A%2F%2Fapi-dev.thebestshop.ca%2Fwxredirect&response_type=code&scope=snsapi_login&state=3d6be0a4035d839573b04816624a415e#wechat_redirect

And surprisingly the following url is working as expected but ONLY works within the wechat native application broswer (it doesn't work in Chrome, Firefox, Safari):

https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx**************ec&redirect_uri=http://api-dev.thebestshop.ca/wxredirect&response_type=code&scope=snsapi_userinfo&state=STATE&connect_redirect=1#wechat_redirect

I've checked it is not about the redirect URL encoding problem because I tried both encoded and non-encoded but still no luck.

And I've also found the following thread on stack overflow which our situation is very similar but the solution is not working for me either (My account is already a verified Wechat Service Account):

WeChat Social Login

1

There are 1 best solutions below

0
On

Your mothed is not correct in the scene. I guess the wechat open platform will help you. https://open.weixin.qq.com/

If you want to integrate common website wechat-login.You need register website application in your open-platform account.

Steps:

1.Registering open-platform account.

2.Making authentication.To submit your company information.

3.Add website application.After it you can get the appid for your website application and secret-key.

  1. Html code: use appid and secret-key to build a auth-code.Next using the code to build auth url and put the url in "".With opening the page,you can see the iframe show the qrcode.The url is start with wechat's doname.

5.When user scan the qrcode with wechat by camera,the client will get the auth-code.Sending it to serve to get information of user like "openid" and "unionid".