Angular Service Worker with HttpIntercepters

Maheswari Sivanandam 76 Reputation points
2022-02-25T14:12:08.82+00:00

I am getting 504 error when the JWT token is expired. When I debug the problem I found that the error is not coming from API, it is just coming from proxy server(Angular service worker).
Is there a way to refresh the Jwt token with angular service worker?

If I don't use Angular service worker, token is refreshed and I am not getting 504 error.

Developer technologies ASP.NET ASP.NET Core
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
    2022-02-25T17:09:59.187+00:00

    it depend on how the JWT token is supplied.

    if a username & password api call, it can renew if it has both.

    if you are using oauth, then your service could store a refresh token, which can be used via an api call to get a new token (though refresh tokens eventually expire). if refresh token expires or not supported, then the service worker can not get a new token as it requires a UI and web flow.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.