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

TokenError defaults don't follow the RFC 6749 #221

Open
dposs-likindo opened this issue Feb 15, 2018 · 0 comments
Open

TokenError defaults don't follow the RFC 6749 #221

dposs-likindo opened this issue Feb 15, 2018 · 0 comments

Comments

@dposs-likindo
Copy link

According to RFC 6749 (The OAuth 2.0 Authorization Framework):

5.2. Error Response

The authorization server responds with an HTTP 400 (Bad Request)
status code (unless specified otherwise).

From https://tools.ietf.org/html/rfc6749#section-5.2

As you can see in this section of RFC, the only exception is the "invalid_client" error, when the HTTP 401 (Unauthorized) status code may be supplied.

But, looking at the TokenError, we see these status codes, which go against the RFC:

function TokenError(message, code, uri, status) {
	if (!status) {
		switch (code) {
			case 'invalid_request': status = 400; break;
			case 'invalid_client': status = 401; break;
			case 'invalid_grant': status = 403; break;
			case 'unauthorized_client': status = 403; break;
			case 'unsupported_grant_type': status = 501; break;
			case 'invalid_scope': status = 400; break;
		}
	}
	...
}
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

1 participant