axios-jwt icon indicating copy to clipboard operation
axios-jwt copied to clipboard

Any way to avoid decoding the JWT token in geTtimestampFromToken?

Open mrhighstone opened this issue 10 months ago • 0 comments

I love the simplicity of this solution and implemented it in a VueJS/TypeScript application connecting to a .NET Core 8 WebAPI using the recently released ASP.NET Core Identity Web API.

So far so good, but unfortunately I receive the following exception when the authTokenInterceptor is trying to refresh te tokens.

Error: Unable to refresh access token for request due to token refresh error: Invalid token specified: e2 is undefined

Eventually I nailed this down to the method getTimestampFromToken where jwtDecode<JwtPayload>(token) fails to decode the JWT token.

Now it appears that the implementation of ASP.NET Core Identity Web API does not use JWT tokens but uses custom tokens instead. So obviously, the token cannot be deconstructed.

Is there a way/trick/possibility to not fail on this method and still refresh the token - other than implementing JWT tokens in the backend - and still being able to use this awesome solution?

mrhighstone avatar Feb 12 '25 18:02 mrhighstone