獲取微信openid

經過這篇文章,成功獲取到了Openid:php

http://www.cnblogs.com/txw1958/p/weixin76-user-info.htmlhtml

官方參考:https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1455784140&token=&lang=zh_CNweb

但也遇到幾個問題:api

1,redirect_uri 參數錯誤微信

https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx8888888888888888&redirect_uri=http://mascot.duapp.com/oauth2.php&response_type=code&scope=snsapi_userinfo&state=1#wechat_redirec

用正確的appid和redirect_uri替換後,在微信web開發工具中輸入連接,出現此錯誤

緣由:受權回調頁面域名未設置
設置地址位置:
登陸公衆平臺:
開發——>接口權限——>網頁帳號——>修改

2,Scope 參數錯誤或沒有 Scope 權限
經過對受權回調頁面的設置,原本已經正常了,出現這個問題的緣由是,在複製連接地址的過程當中,不當心在地址中加入了回車鍵,以下:
https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx8888888888888888&redirect_uri=http://mascot.duapp.com/oauth2.php&response_type=code&scope=snsapi_userinfo&state=1#wechat_redirec
相關文章
相關標籤/搜索