web前端|uni|app

打包后微信登陸提示登陸失敗,授權頁面可以跳轉,用戶點擊過確定授權后 返回APP 直接提示登錄失敗,沒有進入 success 也沒有進入 fail ,下面是代碼,簽名和報名已經是對的了,appid 和 appsecret 也沒有問題
uni.login({ provider: 'weixin', success: (res) => { uni.showToast({ title: '登陸成功' }); }, fail: (res) => { /* uni.showModal({ title: '登陸失敗', content: encodeURIComponent(JSON.stringify(res)), }) */ uni.showToast({ title: '登陸失敗123', icon: 'none' }) } })
解決辦法:
大家開發需要注意
配置文件修改 appid appsecret
微信開放平臺的包名 一定要和打包時候的一樣,
微信開放平臺的簽名 一般就是 59201cf6589202cb2cdab26752472112,具體需要自己獲取,使用微信提供的 獲取簽名的工具獲取 具體看 https://blog.csdn.net/m00123456789/article/details/56481656
還有微信緩存問題也很頭疼,測試失敗后需要重新安裝微信再測試,因為微信會緩存你的 appid 和 appsecret,導致你每次測試都出現錯誤