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

Throw a 401 error when using no or expired token when using content/type application/json #24

Closed
georgevanvliet opened this issue Feb 25, 2020 · 2 comments

Comments

@georgevanvliet
Copy link

Currently, when consuming the api as a JSON client, with content-type set to application/json, a 302 redirect is thrown when using none or an expired/invalid token. There is no way for the client to detect that its token has expired. Other than having a 302 imply an authentication failure and grep the body for login :(

Please throw 401 errors when the token is not present or invalid, and the content-type is anything other than html, e.g. application/json.

Also see #14 for further improvements. Currently there is no way to derive the ttl of the token and we need to wait for a call to fail, before we present the login screen.

@pvgennip
Copy link
Collaborator

pvgennip commented Feb 26, 2020

This is solved by adding this header to your requests Accept : application/json

@pvgennip
Copy link
Collaborator

Default behaviour is to redirect to the login screen

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

No branches or pull requests

2 participants