How to obtain and store data after vue Wechat scanned the code and logged in

vue project, use Wechat"s third-party website to scan the code to log in, according to the official document

  • first step

     var obj = new WxLogin({
     self_redirect:true,
     id:"login_container", 
     appid: "", 
     scope: "", 
     redirect_uri: "",  //
      state: "",
     style: "",
     href: ""
     });
    
  • the second step is to get the interface of access_token through the address + code redirected in the previous step.

    http: GET
    https://api.weixin.qq.com/sns/oauth2/access_token?appid=APPID&secret=SECRET&code=CODE&grant_type=authorization_code

what I don"t understand is that Wechat"s code-scanning authentication page does not have a specified callback function to accept the return of the backend, so how to obtain the backend-related data and token and return it to the vue page is directly redirected to the frontend page (url with parameters)?


We do this by getting Wechat's token to request Wechat's user information, and then matching whether the openid is in our database
if there is any, log in for the user. The backend will set cookie in the browser, and then the front-end interface will log in with cookie, if there is no cookie.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b31774-2aade.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b31774-2aade.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?