【发布时间】:2018-12-11 17:33:07
【问题描述】:
我在一个新的 Expo/React Native 应用程序中实现 Auth0 身份验证,遵循以下示例: https://github.com/expo/auth0-example
我唯一更改的是scope: 'openid profile',在示例中为scope: 'openid name',尽管我也使用示例中的代码进行了尝试。
正如您在以下屏幕截图中所见,我得到的是 access_token 而不是 id_token:
这是使用 Auth0 进行身份验证的代码:
_loginWithAuth0 = async () => {
const redirectUrl = AuthSession.getRedirectUrl();
console.log(`Redirect URL (add this to Auth0): ${redirectUrl}`);
const result = await AuthSession.startAsync({
authUrl: `${auth0Domain}/authorize` + toQueryString({
client_id: auth0ClientId,
response_type: 'token',
scope: 'openid profile',
redirect_uri: redirectUrl,
}),
});
console.log(result);
if (result.type === 'success') {
this.handleParams(result.params);
}
}
我尝试将response_type 更改为token id_token,但抛出了配置错误提示。
如何获得id_token?
【问题讨论】:
-
能否请您提供配置错误。
标签: react-native expo auth0