關於微信掃碼登錄的整理(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參數不對或未授權
 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM