关于微信扫码登录的整理(Scope 参数错误或没有 Scope 权限)

 

参考资料

微信网页开发 /网页授权
https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/Wechat_webpage_authorization.html#3
网站应用微信登录开发指南
https://developers.weixin.qq.com/doc/oplatform/Website_App/WeChat_Login/Wechat_Login.html
 
微信二维码登录SCOPE
//电脑端 扫码授权登录
public static string AuthUrl = "https://open.weixin.qq.com/connect/qrconnect?appid={0}&redirect_uri={1}&response_type=code&scope=snsapi_login&state={2}#wechat_redirect";
 
//移动端 直接授权登录
public static string AuthUrl = "https://open.weixin.qq.com/connect/oauth2/authorize?appid={0}&redirect_uri={1}&response_type=code&scope=snsapi_login&state={2}#wechat_redirect";
 
//获取 Token
public static string TokenRequestUrl = "https://api.weixin.qq.com/sns/oauth2/access_token?grant_type=authorization_code&appid={0}&secret={1}&code={2}";
 
//获取 用户信息
public static string GetUserInfoUrl = "https://api.weixin.qq.com/sns/userinfo?access_token={0}&openid={1}";
 
微信公众号(公众平台) 和 微信开放平台 是两码事(各自有各自的appid,seciresid)。
公众号(公众平台)获取的scope只包括两种:snsapi_base 和snsapi_userinfo,前者是静默获取,用户无感知;后者是需要用户确认同意的。
微信开放平台(https://open.weixin.qq.com/) 用 scope=snsapi_login (这里不等同于公众号登录),如果用公众号的appid,则会提示 scope参数不对或未授权
 
posted @ 2022-03-24 10:02  天码行空之码不停蹄  阅读(2062)  评论(0编辑  收藏  举报