4

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

sashoalm
  • 75,001
  • 122
  • 434
  • 781
Trevor. W
  • 451
  • 1
  • 5
  • 13
  • i'm experiencing the same thing, really frustrated... have you found a solution? – mountriv99 Nov 19 '19 at 19:25
  • i'm using the sandbox account btw https://mp.weixin.qq.com/debug/cgi-bin/sandboxinfo?action=showinfo&t=sandbox/index – mountriv99 Nov 19 '19 at 19:28
  • Does this answer your question? [WeChat Social Login](https://stackoverflow.com/questions/44667660/wechat-social-login) – sashoalm Jun 30 '21 at 07:55

1 Answers1

0

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".

taolu
  • 311
  • 1
  • 8