-
Notifications
You must be signed in to change notification settings - Fork 3
OIDC Client and Journey Client Bug Fixes #511
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -289,16 +289,18 @@ export async function oidc<ActionType extends ActionTypes = ActionTypes>({ | |
| options: storageOptions, | ||
| }); | ||
| }), | ||
| Micro.tap(async (tokens) => { | ||
| await store.dispatch( | ||
| oidcApi.endpoints.revoke.initiate({ | ||
| accessToken: tokens.accessToken, | ||
| clientId: config.clientId, | ||
| endpoint: wellknown.revocation_endpoint, | ||
| }), | ||
| ); | ||
| await storageClient.remove(); | ||
| await storageClient.set(tokens); | ||
| Micro.tap(async (newTokens) => { | ||
| if (tokens && 'accessToken' in tokens) { | ||
| await store.dispatch( | ||
| oidcApi.endpoints.revoke.initiate({ | ||
| accessToken: tokens.accessToken, | ||
| clientId: config.clientId, | ||
| endpoint: wellknown.revocation_endpoint, | ||
| }), | ||
| ); | ||
| await storageClient.remove(); | ||
| } | ||
| await storageClient.set(newTokens); | ||
| }), | ||
|
Comment on lines
+292
to
304
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These changes appear unrelated to the PR objectives. The PR title indicates this is about fixing 🤖 Prompt for AI AgentsConsider error handling and atomic storage updates. The token renewal logic has several concerns:
🔎 Proposed fix with better error handling Micro.tap(async (newTokens) => {
if (tokens && 'accessToken' in tokens) {
- await store.dispatch(
- oidcApi.endpoints.revoke.initiate({
- accessToken: tokens.accessToken,
- clientId: config.clientId,
- endpoint: wellknown.revocation_endpoint,
- }),
- );
- await storageClient.remove();
+ if (wellknown.revocation_endpoint) {
+ try {
+ await store.dispatch(
+ oidcApi.endpoints.revoke.initiate({
+ accessToken: tokens.accessToken,
+ clientId: config.clientId,
+ endpoint: wellknown.revocation_endpoint,
+ }),
+ );
+ } catch (error) {
+ log.warn('Failed to revoke old access token during renewal', error);
+ }
+ }
}
await storageClient.set(newTokens);
}),🤖 Prompt for AI Agents |
||
| ); | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch