1.登录谷歌开发者后台
https://console.developers.google.com/
2.添加凭证
3.拿到客户端id后,项目中配置google登录:
示例代码:
javascript
async googleLogin(){
const { provider } = await uni.getProvider({ service:'oauth' })
if(provider.includes('google')){
const { authResult } = await uni.login({ provider: 'google'})
console.log(authResult,'login_rs');
//请求后端接口完成登录
}
}