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

rm comma after Bearer in WWW-Authenticate header #787

Merged
merged 1 commit into from Nov 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 2 additions & 5 deletions oauthlib/oauth2/rfc6749/errors.py
Expand Up @@ -103,15 +103,12 @@ def headers(self):
value "Bearer". This scheme MUST be followed by one or more
auth-param values.
"""
authvalues = [
"Bearer",
'error="{}"'.format(self.error)
]
authvalues = ['error="{}"'.format(self.error)]
if self.description:
authvalues.append('error_description="{}"'.format(self.description))
if self.uri:
authvalues.append('error_uri="{}"'.format(self.uri))
return {"WWW-Authenticate": ", ".join(authvalues)}
return {"WWW-Authenticate": "Bearer " + ", ".join(authvalues)}
return {}


Expand Down
4 changes: 2 additions & 2 deletions tests/oauth2/rfc6749/endpoints/test_introspect_endpoint.py
Expand Up @@ -87,7 +87,7 @@ def test_introspect_token_client_authentication_failed(self):
'Content-Type': 'application/json',
'Cache-Control': 'no-store',
'Pragma': 'no-cache',
"WWW-Authenticate": 'Bearer, error="invalid_client"'
"WWW-Authenticate": 'Bearer error="invalid_client"'
})
self.assertEqual(loads(b)['error'], 'invalid_client')
self.assertEqual(s, 401)
Expand Down Expand Up @@ -115,7 +115,7 @@ def test_introspect_token_public_client_authentication_failed(self):
'Content-Type': 'application/json',
'Cache-Control': 'no-store',
'Pragma': 'no-cache',
"WWW-Authenticate": 'Bearer, error="invalid_client"'
"WWW-Authenticate": 'Bearer error="invalid_client"'
})
self.assertEqual(loads(b)['error'], 'invalid_client')
self.assertEqual(s, 401)
Expand Down
4 changes: 2 additions & 2 deletions tests/oauth2/rfc6749/endpoints/test_revocation_endpoint.py
Expand Up @@ -55,7 +55,7 @@ def test_revoke_token_client_authentication_failed(self):
'Content-Type': 'application/json',
'Cache-Control': 'no-store',
'Pragma': 'no-cache',
"WWW-Authenticate": 'Bearer, error="invalid_client"'
"WWW-Authenticate": 'Bearer error="invalid_client"'
})
self.assertEqual(loads(b)['error'], 'invalid_client')
self.assertEqual(s, 401)
Expand Down Expand Up @@ -83,7 +83,7 @@ def test_revoke_token_public_client_authentication_failed(self):
'Content-Type': 'application/json',
'Cache-Control': 'no-store',
'Pragma': 'no-cache',
"WWW-Authenticate": 'Bearer, error="invalid_client"'
"WWW-Authenticate": 'Bearer error="invalid_client"'
})
self.assertEqual(loads(b)['error'], 'invalid_client')
self.assertEqual(s, 401)
Expand Down