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

Correct handling of malformed tokens with compliant 401 response according to RFC 6750 #118

Open
wants to merge 3 commits into
base: user-tokens
Choose a base branch
from

Conversation

jan-thoma
Copy link

invalid_token

The access token provided is expired, revoked, malformed, or invalid for other reasons. The resource SHOULD respond with the HTTP 401 (Unauthorized) status code. The client MAY request a new access token and retry the protected resource request.

@markhuot
Copy link
Owner

I like this a lot. The only thing we lose is any messaging around expired tokens, which I think can be especially helpful for debugging purposes. Would it break the spec to return a message like token_expired instead of token_invalid?

@jan-thoma
Copy link
Author

Firebase actually throws 2 messages on validation one is token expired the other one is JSON malformed. This could be implemented as a json response following the graphql style.

@markhuot
Copy link
Owner

Interesting, this is all really helpful, thanks! Do you happen to have a link to where this is in the Firebase docs? I'd love to learn from it. In the meantime I'll take a look at what sort of messaging we can change here.

@jan-thoma
Copy link
Author

nope, there are no docs about exceptions, if you remove the try catch block. you get the stack trace of the two classes.

@jan-thoma
Copy link
Author

i would like to see it happen that the user-token branch gets merged in the official repo in the next months. We work on a project where craftql fits in perfectly and saves us tons of time.

@markhuot
Copy link
Owner

Yup, that seems doable. I'd like to get it merged by the end of July, but that might be tight with some other things competing for my time. Certainly by the end of August though. If there's a specific date or need feel free to email me directly (email is on my GitHub profile) and we can discuss.

@jan-thoma
Copy link
Author

August fits perfectly. i have ideas some which maybe worth considering, i will send you an email later.

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