Invalid token exception #37
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces improved handling of invalid or expired JWT tokens in the backend, ensuring that authentication errors are handled gracefully and communicated clearly to both the frontend and the user. It also updates the frontend to better handle authentication failures and changes the API base URL.
Backend: Enhanced JWT Error Handling
InvalidTokenExceptionto represent invalid or expired JWT tokens.TokenServiceto throw specificInvalidTokenExceptionerrors for different JWT validation failures, with clear error messages and logging for each error type. [1] [2] [3]SecurityFilterto catch exceptions during authentication and delegate error handling to the global exception resolver, ensuring consistent error responses. [1] [2]RestExceptionHandlerto return a 403 Forbidden response with details when anInvalidTokenExceptionis thrown.Frontend: Improved Authentication Error Handling & API Endpoint Update
axiosConfig.jsto a new endpoint.