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

incorrect requests return status code 200 #234

Closed
fgehrlicher opened this issue May 23, 2019 · 5 comments
Closed

incorrect requests return status code 200 #234

fgehrlicher opened this issue May 23, 2019 · 5 comments

Comments

@fgehrlicher
Copy link

fgehrlicher commented May 23, 2019

Many endpoints return http status 200 in case of a faulty request (like wrong credentials or invalid recovery token). Is that behavior intended?

@aarondl
Copy link
Member

aarondl commented May 23, 2019

This is when in api mode?

@fgehrlicher
Copy link
Author

fgehrlicher commented May 23, 2019

Yes i am using authboss as json api.
The response indicates an error but still returns status 200.

json { "error": "Invalid Credentials", "modules": { "auth": true, "confirm": true, "lock": true, "logout": true, "recover": true, "register": true }, "status": "failure" }

@aarondl
Copy link
Member

aarondl commented May 23, 2019

It's intentional. It's sort of a side effect from it being able to support both JSON and HTML Forms. In that that same error would be a 200 OK in an HTML Form response.

In our applications we'll simply do a conditional JSON parse, if "status": "true" key and value exist then we know to parse it as an authboss JSON error (mostly the format you're looking at there).

Authboss doesn't really try to be a restful API and use status codes to indicate problems with user information for application level issues, only request/protocol/server level issues (bad requests for an form post, internal server errors etc). Analyzing the response is the only way to know if something went wrong.

@fgehrlicher
Copy link
Author

ok that reasonable. thank you for clarifying!

@frederikhors
Copy link
Contributor

frederikhors commented Sep 29, 2019

Is this related to #248, @fgehrlicher?

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

3 participants