小程序授权登录是小程序必不可少的功能,直接上我项目的原代码吧
第一步:
我这里是判断用户环境,由于我项目需要配合三个端来使用,原生安卓和ios都需要嵌套我前端小程序的页面,所以这里写了两套
第二步:
调用uniapp提供的api,拿到code,用code来换取token和openid
直接上源码,希望能帮助到各位刚入行的前端小伙伴
小程序授权登录是小程序必不可少的功能,直接上我项目的原代码吧
第一步:
我这里是判断用户环境,由于我项目需要配合三个端来使用,原生安卓和ios都需要嵌套我前端小程序的页面,所以这里写了两套
第二步:
调用uniapp提供的api,拿到code,用code来换取token和openid
直接上源码,希望能帮助到各位刚入行的前端小伙伴