Google认证中同时获取access token与id token的问题求助
Expo Google认证同时获取Access Token和ID Token的解决方法
要同时拿到Google认证的Access Token和ID Token,只需将responseType参数设置为"id_token token"即可,具体修改后的代码如下:
const [request, response, promptAsync] = Google.useAuthRequest({ expoClientId: "xxxx", iosClientId: "xxxx", androidClientId: "xxxx", webClientId: "xxxx", responseType: "id_token token", });
在OAuth 2.0隐式授权流程里,responseType的取值决定了认证服务返回的凭证类型:单独设为"id_token"只会返回用于身份校验的ID Token;不设置的话默认是"token",只会返回用于API访问的Access Token。只有同时指定id_token和token,服务端才会一次性返回两种凭证。
内容的提问来源于stack exchange,提问作者jonathan Leco Ramos
相关产品推荐
相关产品推荐

