Skip to content

Commit 0bc297f

Browse files
committed
fix(oidc-client): fix token force renew
1 parent 20a8cdf commit 0bc297f

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

packages/oidc-client/src/lib/client.store.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -289,16 +289,18 @@ export async function oidc<ActionType extends ActionTypes = ActionTypes>({
289289
options: storageOptions,
290290
});
291291
}),
292-
Micro.tap(async (tokens) => {
293-
await store.dispatch(
294-
oidcApi.endpoints.revoke.initiate({
295-
accessToken: tokens.accessToken,
296-
clientId: config.clientId,
297-
endpoint: wellknown.revocation_endpoint,
298-
}),
299-
);
300-
await storageClient.remove();
301-
await storageClient.set(tokens);
292+
Micro.tap(async (newTokens) => {
293+
if (tokens && 'accessToken' in tokens) {
294+
await store.dispatch(
295+
oidcApi.endpoints.revoke.initiate({
296+
accessToken: tokens.accessToken,
297+
clientId: config.clientId,
298+
endpoint: wellknown.revocation_endpoint,
299+
}),
300+
);
301+
await storageClient.remove();
302+
}
303+
await storageClient.set(newTokens);
302304
}),
303305
);
304306

0 commit comments

Comments
 (0)