Unable to get accessToken in offline mode returning "null"?
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 20/100
- issue の種類
- バグ
- 明瞭さ
- 説明が足りない
- 活発さ
- 停滞
- 技術スタック
- azure, javascript, react-native
- 領域
- authentication, mobile
調査の方向性
この報告ではリポジトリのファイルもテストも示されていないため、提示されている getAzureApiAccessConfig と getAccessTokenAsync のフローから始め、提供された Azure の認証エンドポイントとトークンエンドポイントを使用してください。offline_access のケースを再現し、null トークンがライブラリに由来するのか、アプリケーションに保存されたトークンデータに由来するのかを追跡してください。完了の条件は、再現可能なライブラリの不具合を特定するか、必要な設定変更を文書化することです。
索引モデルが 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
- フォーク
- 472
- 平均マージ
- 3日 7時間
- マージ済み PR(30日)
- 3
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
FormidableLabs/react-native-app-auth のほかの issue
-
iOS: redirect after a failed authorize() crashes the app (finished session kept as _currentSession)対応中かも @federicobartoli が 5 日前に担当しました。 オープン
難易度 3/5 半日 初心者へのやさしさ 35/100
-
[Android] AuthorizationService is never disposed: Custom Tabs bind leak breaks refresh() permanently after ~1000 calls対応中かも @pranshuchittora が 65 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 62/100
-
Android: opt-in Partial Custom Tab (bottom-sheet) for the authorization flow対応中かも @omeratt が 144 日前に担当しました。 オープン
難易度 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
-
Status: Pending Review Type: Feature Request
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
OpenRefine/OpenRefine#8019 ·
メンテナーはふだん 1 日以内に返信
-
`timer` rule rejects dates the engine accepts対応中かも @MFA-G が今日担当しました。 オープンbug ready
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
camunda/bpmnlint-plugin-camunda-compat#281 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
status: waiting-for-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信