Wechat web page license 40163 code has been used

getting the details of the user indicates that 40163 error code has been used, but I have not stored or used code. This error occurs every time, and it has not been successfully authorized. And this page will appear when calling the callback function getDetailInfo. I don"t see if anyone else"s =

.

clipboard.png

Code

public function getUserDetail(){
        $appid="wxccc324b35ed44896";
        $redirect_uri=urlencode("http://flowerwithpiggy.duapp.com/index.php/Weixin/getDetailInfo");
        $url="https://open.weixin.qq.com/connect/oauth2/authorize?appid=".$appid."&redirect_uri=".$redirect_uri."&response_type=code&scope=snsapi_userinfo&state=123-sharpwechat_redirect";
        //
        header("location:".$url);
    }
    /**
     * access_token
     * @return [type] [description]
     */
    public function getDetailInfo(){
        $appid="wxccc324b35ed44896";
        $secret="a23db7dedbdab946f473e26d07199f6e";
        $code=$_GET["code"];
        $url="https://api.weixin.qq.com/sns/oauth2/access_token?appid=".$appid."&secret=".$secret."&code=".$code."&grant_type=authorization_code";
        $res=$this->http_curl($url);
        // if($res["errcode"]){

        // }
        $access_token=$res["access_token"];
        var_dump($res);
        $openid=$res["openid"];
        $url="https://api.weixin.qq.com/sns/userinfo?access_token=".$access_token."&openid=".$openid."&lang=zh_CN";
        $res=$this->http_curl($url);
        var_dump($res);
    }

you're kidding. Isn't that what they say?


flowerwithpiggy.duapp.com

what the heck is this URL? when you get user information and ask users to jump to authorization, you should follow the one in the manual.
if this URL is your own, then let this URL jump to Wechat's authorized address and return the user information obtained to you.

https://open.weixin.qq.com/co. if you prompt" the link cannot be accessed ", check whether the parameter is entered incorrectly and have the authorization scope permission corresponding to the scope parameter.

this is the right thing

there should be a problem with your access
you are directly on your page
header ('Location: https://open.weixin.qq.com/co..) ;

          getcodecodehttps://api.weixin.qq.com/sns/oauth2/access_token?appid=openid

there are links in which code, should share the previous authorization.


I don't know if your problem has been solved. Recently, I also encountered this problem. I used tp5, and then I checked it for a long time. I found that when I asked code to send once, and then did not perform the insert data, I received the code once. If the execution is inserted into the database, code receives it twice, which is a bit strange. But I can't find the reason, because I put the step of getting openid in the _ initialize method, and from the record, when executing the insert statement, _ initialize is also executed twice, which is amazing. What's even more amazing is that I found that when I asked for code, state was written as snsapi_base, and after I changed state to STATE in Wechat's manual, it was normal to perform the step of inserting into the database, that is, code only received it once. This is strange, but I can't find any other reason. I shared my experience


Wechat called back twice. Need to prevent repeated callbacks in the business

Menu