Unable to get accessToken in offline mode returning "null"?
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 20/100
- Issue 类型
- 缺陷
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- azure, javascript, react-native
- 领域
- authentication, mobile
调研方向
报告没有指出任何仓库文件或测试;请从所示的 getAzureApiAccessConfig 和 getAccessTokenAsync 流程开始,并使用提供的 Azure 授权端点和令牌端点。复现 offline_access 情况,并追踪 null token 是来自库,还是来自应用存储的令牌数据。完成的标准是确定一个可复现的库缺陷,或记录所需的配置更改。
由索引模型根据 Issue 内容生成。
描述
In offline mode, the Access token returns null even added the "offline_access" in the scope
Here the scope
API_ACCESS_SCOPE: [
'offline_access',
'api://xxxxxxxxxxxxxxxxxx/api-access',
],
getAzureApiAccessConfig() {
return {
issuer: ${MS_BASE_API_URL}${TENANT_ID}/v2.0,
clientId: APP_ID,
redirectUrl: REDIRECT_URL,
scopes: API_ACCESS_SCOPE,
// additionalParameters: {prompt: 'select_account'},
serviceConfiguration: {
authorizationEndpoint: `${MS_BASE_API_URL}${TENANT_ID}/oauth2/v2.0/authorize`,
tokenEndpoint: `${MS_BASE_API_URL}${TENANT_ID}/oauth2/v2.0/token`,
revocationEndpoint: `${MS_BASE_API_URL}${TENANT_ID}/oauth2/v2.0/logout`,
},
};
}
async getAccessTokenAsync() {
try {
const userInfo = await this.getUserInfo();
const expireTime = userInfo.apiAccessTokens
? userInfo.apiAccessTokens.expiryTime
: null;
console.log('expireTime :>> ', expireTime);
if (expireTime !== null) {
// Get expiration time - 5 minutes
// If it's <= 5 minutes before expiration, then refresh
const expire = sub(parseISO(expireTime), {minutes: 5});
const now = new Date();
console.log(
'Expire comparison :>> ',
expire,
now,
compareAsc(now, expire),
);
if (compareAsc(now, expire) >= 0) {
// Expired, refresh
console.log('Refreshing token');
const refreshToken = userInfo.apiAccessTokens
? userInfo.apiAccessTokens.refreshToken
: null;
console.log(`Refresh token: ${refreshToken}`);
const result = await refresh(this.getAzureApiAccessConfig(), {
refreshToken: refreshToken || '',
});
if (!result?.accessToken) {
await this.logOut();
return null;
}
// Store the new access token, refresh token, and expiration time in storage
await SECURE_STORAGE.saveData(KEY_AUTH_USER_INFO, {
...userInfo,
apiAccessTokens: {
accessToken: result.accessToken,
refreshToken: result.refreshToken ?? '',
expiryTime: result.accessTokenExpirationDate,
},
});
return result.accessToken;
}
// Not expired, just return saved access token
const accessToken = userInfo.apiAccessTokens
? userInfo.apiAccessTokens.accessToken
: null;
return accessToken;
}
return null;
} catch (error) {
console.log('error while fetching access token :>> ', error);
await this.logOut();
return null;
}
}
please help me what's went wrong?
- 主要语言
- Java
- 星标
- 2.3k
- 派生
- 471
- 平均合并
- 3 天 7 小时
- 30 天内合并 PR
- 3
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
FormidableLabs/react-native-app-auth 的其他 Issue
-
iOS: redirect after a failed authorize() crashes the app (finished session kept as _currentSession)可能已有人在做 @federicobartoli 今天认领。 未关闭
难度 3/5 半天 新手友好度 35/100
-
[Android] AuthorizationService is never disposed: Custom Tabs bind leak breaks refresh() permanently after ~1000 calls可能已有人在做 @pranshuchittora 于 60 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 62/100
-
Android: opt-in Partial Custom Tab (bottom-sheet) for the authorization flow可能已有人在做 @omeratt 于 140 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 35/100
-
难度 4/5 3-5 天 新手友好度 35/100
-
难度 4/5 3-5 天 新手友好度 48/100
FormidableLabs/react-native-app-auth#1108 · 1 条评论 ·
查看 FormidableLabs/react-native-app-auth 的全部 Issue
相似的 Issue
-
`Processing lsp` never exits and leaves orphaned processes可能已有人在做 @overcast302 今天认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 72/100
processing/processing4#1578 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 60/100
维护者通常 1 天内回复
-
[BUG] S3 CORS responses omit Access-Control-Allow-Credentials for matched origins可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
securityHeaders replaces a route's own Content-Security-Policy (0.9.9; weakens embedders' pages)未关闭bug
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
sqlcipher/sqlcipher-android#97 · 1 条评论 ·