Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(api-client): do not reauth if no credentials are available #65

Merged
merged 2 commits into from
Apr 5, 2024

Conversation

igor-erziak
Copy link

Currently, the api client tries to re-authenticate using credentials (username + password) in case the token is invalid (401 response is received on any request). However, attempting this when there were no credentials configured when creating the client doesn't make sense. It results in a misleading 400 error saying {"password": ["This field may not be blank."]}.

This change fixes it by transparently returning the 401 when the token is invalid and the credentials are missing. This way, the code using the client can deal with the invalid token issue on its own (e.g. display a user friendly message).

@igor-erziak igor-erziak force-pushed the igor/no-reauth-without-credentials branch from dac1ee8 to d937dae Compare April 5, 2024 12:06
@igor-erziak igor-erziak force-pushed the igor/no-reauth-without-credentials branch from d937dae to 033063f Compare April 5, 2024 12:30
@igor-erziak igor-erziak requested a review from bara-m April 5, 2024 12:35
@bara-m bara-m merged commit 92697e6 into main Apr 5, 2024
12 checks passed
@bara-m bara-m deleted the igor/no-reauth-without-credentials branch April 5, 2024 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants