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

[All] Correcting Bearer Authorization header #698

Merged
merged 2 commits into from
Nov 21, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion oauthenticator/oauth2.py
Original file line number Diff line number Diff line change
Expand Up @@ -716,10 +716,17 @@ def build_userdata_request_headers(self, access_token, token_type):
Builds and returns the headers to be used in the userdata request.
Called by the :meth:`oauthenticator.OAuthenticator.token_to_user`
"""

# token_type is case-sensitive, but the headers are
yaleman marked this conversation as resolved.
Show resolved Hide resolved
if token_type.lower() == "bearer":
auth_token_type = "Bearer"
else:
auth_token_type = token_type

return {
"Accept": "application/json",
"User-Agent": "JupyterHub",
"Authorization": f"{token_type} {access_token}",
"Authorization": f"{auth_token_type} {access_token}",
}

def build_token_info_request_headers(self):
Expand Down