Auth0 /oauth/access_token 获取 refresh_token 移动应用程序?
Auth0 /oauth/access_token obtain refresh_token mobile app?
我在我的 React-Native 移动应用程序中使用 Facebook SDK,我设法获得了一个令牌,我在 /oauth/access_token
上与 Auth0 交换以检索一个 id_token
,我可以将其用作 jwt
来验证我的 API。
问题:该端点没有 return refresh_token
这对于移动应用至关重要,因为它不会每次都要求用户进行身份验证。
我怎样才能获得 Auth0 refresh_token
才能让用户每天都登录 Facebook 并再次登录整个过程?
很遗憾,我无法使用 Auth0 Lock
登录 UI,因为 React-Native 版本目前不支持自定义 UI。
您可以在此处找到当前文档:https://auth0.com/docs/tokens/preview/refresh-token#get-a-refresh-token
根据文档,只要您在原始请求中包含 offline_access
范围,您就应该在请求 /oauth/access_token
后获得刷新令牌。
如果不是这样,我会提供错误支持。
它没有记录,但您可以在 /oauth/access_token
端点上请求 refresh_token
,在 scope
中添加 offline_access
和 device
名称。
request({
method: 'POST',
url: `https://${AUTH0_URL}/oauth/access_token`,
data: {
client_id: CLIENT_ID,
access_token: FBToken,
connection: 'facebook',
scope: 'openid profile email offline_access',
device: 'mobile phone',
},
})
我在我的 React-Native 移动应用程序中使用 Facebook SDK,我设法获得了一个令牌,我在 /oauth/access_token
上与 Auth0 交换以检索一个 id_token
,我可以将其用作 jwt
来验证我的 API。
问题:该端点没有 return refresh_token
这对于移动应用至关重要,因为它不会每次都要求用户进行身份验证。
我怎样才能获得 Auth0 refresh_token
才能让用户每天都登录 Facebook 并再次登录整个过程?
很遗憾,我无法使用 Auth0 Lock
登录 UI,因为 React-Native 版本目前不支持自定义 UI。
您可以在此处找到当前文档:https://auth0.com/docs/tokens/preview/refresh-token#get-a-refresh-token
根据文档,只要您在原始请求中包含 offline_access
范围,您就应该在请求 /oauth/access_token
后获得刷新令牌。
如果不是这样,我会提供错误支持。
它没有记录,但您可以在 /oauth/access_token
端点上请求 refresh_token
,在 scope
中添加 offline_access
和 device
名称。
request({
method: 'POST',
url: `https://${AUTH0_URL}/oauth/access_token`,
data: {
client_id: CLIENT_ID,
access_token: FBToken,
connection: 'facebook',
scope: 'openid profile email offline_access',
device: 'mobile phone',
},
})