Home  >  Q&A  >  body text

java - 微信静默方式 获得的access_token有什么用,即 Scope为snsapi_base时

微信静默方式 获得的access_token有什么用,即 Scope为snsapi_base时 获得code,通过code获得的access_token有什么用,这个access_token和普通access_token和网页授权access_token(Scope为snsapi_userinfo)有什么区别,
实在搞不明白了,有哪位兄弟姐妹给解惑一下,实在整不明白了,

大家讲道理大家讲道理2763 days ago717

reply all(1)I'll reply

  • 迷茫

    迷茫2017-04-18 10:26:51

    I just tested it: there are three user WeChat accounts;
    1. The WeChat account that has followed this official account
    2. The WeChat account that has not followed this official account but has been authorized
    3. The WeChat account that has not been followed or authorized Signal

    In the first case, the user details can be obtained through the access_token and openid obtained in the silent situation.
    The second case is also possible.
    The third case cannot be obtained, and a 48001 error is reported, apiauthorized error

    Conclusion: If there is following or authorized interaction between WeChat ID and official account, the user's detailed information can be obtained silently. If not, it cannot be obtained.

    The interface for obtaining user permissions mentioned above is:

    
    
    https://api.weixin.qq.com/sns/userinfo?access_token=ACCESS_TOKEN&openid=OPENID&lang=zh_CN;
    

    Note that /sns/userinfo?here is user information obtained through special webpage authorization
    And users who follow WeChat ID according to WeChat’s development documents can also obtain user information through ordinary access_token. This API is:

    
    
    https://api.weixin.qq.com/cgi-bin/user/info?access_token=ACCESS_TOKEN&openid=OPENID&lang=zh_CN

    Attention is /cgi-bin/user/info?

    These two APIs are different,

    -The first one is mainly used to obtain detailed information of users who have not followed WeChat ID;
    -The second one is mainly used to obtain users who have followed WeChat ID. For example, when a user follows WeChat ID, the WeChat server sends it to the local server The information includes openid. The second method can obtain the user's detailed information.

    reply
    0
  • Cancelreply