1.3 KiB
1.3 KiB
30. Fix refresh token with OIDC using QueuedInterceptor
Date: 2023-09-11
Status
Superseded by ADR-0035
- Issue: 1974
Context
- Requests still return
401after retrieving a new token. The application automatically logs out
Root cause
- When executing tasks concurrently, they are pushed into the
Queuealong with the oldheadervalues (the old authentication is retained). So when the first request receives a401error and tries to get a new token, it will be updated with the new authentication header value.
Decision
- Use
QueuedInterceptorto serializerequests/responses/errorsbefore they enter the interceptor. If there are multiple concurrent requests, the request is added to a queue before entering the interceptor. Only one request at a time enters the interceptor, and after that request is processed by the interceptor, the next request will enter the interceptor. - Try to make a
retryrequest up to 3 times when receiving a401error. Aims to update the new token value onmemmoryto requests in thequeue.
Consequences
- The following
requestswere completed successfully. The application is not automatically logged out