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

We should be sending a 401 status code not a 403 on expired token. #472

Merged
merged 1 commit into from
May 25, 2017

Conversation

tim-field
Copy link
Contributor

I noticed this issue when using the authMiddleware from https://github.com/nodkz/react-relay-network-layer

authMiddleware provides the following functionality

tokenRefreshPromise: - function(req, err) which must return promise or regular value with a new token. This function is called when server returns 401 status code. After receiving a new token, middleware re-run query to the server with it seamlessly for Relay.

However postgraphql only sends a 403 status code. I was going to create a pull request for authMiddleware but after a bit of research I can see that postgrapqhl should really be sending a 401 in this case*.

Many people will be using authMiddleware with Relay, so this could make things easier all

*https://stackoverflow.com/questions/3297048/403-forbidden-vs-401-unauthorized-http-responses

*https://www.loggly.com/blog/http-status-code-diagram/

@benjie benjie merged commit fa241f4 into graphile:master May 25, 2017
@benjie
Copy link
Member

benjie commented May 25, 2017

Thanks 🙏 If you fancied following this up with a test, that would be great!

Belline pushed a commit to Belline/postgraphql that referenced this pull request Dec 18, 2017
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