Open MichalJana opened 3 months ago
You could use
import { OidcClient } from '@axa-fr/oidc-client';
await getOidc().renewTokensAsync();
The librairy refresh tokens automaticaly in background. The clean way to use it is here: https://github.com/AxaFrance/oidc-client/blob/main/packages/oidc-client/src/fetch.ts
like @meesvandongen said upper, you can use directly @axa-fr/oidc-client.
Hi, using @axa-fr/oidc-client would mean I'd have to unnecessarily create a wrapper that is already provided by @axa-fr/react-oidc. Is it possible to use both packages in the project simultaneously?
Yes it is possible @MichalJana
Hi, I have a question,
When using @axa-fr/react-oidc with RTK Query or Axios, it's not possible to call refreshToken and use refetch process when a 401 error is returned. The issue is that refreshToken cannot be called outside of a tsx component.
Here is an example of how refetch is done in RTK Query, and it's similar in Axios or any other similar libraries as well: Automatic re-authorization by extending fetchBaseQuery
How do you address this situation?