在使用Auth0 API时,当刷新访问令牌(refresh token)时,会发现作用域(scopes)列表会被省略掉。为了解决这个问题,需要手动在refresh token请求中加入scope参数,如下所示:
auth0.refreshToken({
scope: 'openid email' // 添加所需的scope
}).then(function(authResult) {
// 刷新 JWT
console.log('Auth0 access token refreshed');
}).catch(function(err) {
console.log(err); // 处理错误
});
通过向refresh token请求中添加scope参数,作用域列表将不再被省略,将会在刷新的access token中返回。
上一篇:Auth0实现未填充
下一篇:Auth0添加数据