項目是uni-app
需求是需要在用戶進來的時候判斷是從app進入的還是微信進入的,如果是微信進入的話需要獲取到openid傳給后端
坑:
1.跳轉的時候不讓攜帶任何參數 只有配置好的服務器地址
2.獲取code需要微信公眾號進行配置重定向地址
3.獲取到code后還需要再請求一次微信的接口來換取openid
4.需要在微信開發者工具中調試(或微信直接打開鏈接查看效果)
參考:
1.https://blog.csdn.net/hxf6060/article/details/88171869
2.https://blog.csdn.net/kivets/article/details/94625515 調試也可以參考
3.https://www.jianshu.com/p/b5929770f92d
4.https://www.cnblogs.com/gopark/p/9394816.html
5.https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/Web_Developer_Tools.html#%E8%B0%83%E8%AF%95%E5%BE%AE%E4%BF%A1%E7%BD%91%E9%A1%B5%E6%8E%88%E6%9D%83
6.http://caibaojian.com/wxwiki/797653e21e60303b29578a7a1576a07d7672dc58.html
7.https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/Wechat_webpage_authorization.html
8.https://blog.csdn.net/Zmj_Dns/article/details/108714817?utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-3.nolandingword2&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-3.nolandingword2
uni解決跨域
9.https://www.cnblogs.com/xiaoyuanbao/p/13537309.html
10.https://blog.csdn.net/cl11992/article/details/86528704
微信接口驗證平台:
https://mp.weixin.qq.com/debug