Search code examples
phpauthenticationoauth-2.0wechat

authorize user using wechat php


recently tried to use Wechat authentication for my PHP web application but when i try to get auth token it gives me  Error : {"errcode":50001,"errmsg":"user unauthorized hint: [_ue8GA0843e277]"}

I am calling https://api.wechat.com/cgi-bin/token?grant_type=client_credential&appid=wxa1dc8d55458d****&secret=39efd8a98ae56d4f70842527346a**** to get auth token


Solution

  • Errorcode : 50001 states - Unauthorized access.

    This error will happen when the official wechat account is not verified. After verification only you will be able to get the access to the APIs.

    You can easily check this, by accessing the wechat account. Under developer section click on Interface and permission. Here it will provide list of info related to wechat API whether it is "obtained" or "not obtained" under "status". Those that contain the status "Obtained" alone will work and rest wont work.