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

Fix bug in implementation of not yet released basic_auth config #601

Merged
merged 1 commit into from
Apr 25, 2023
Merged
Changes from all commits
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
6 changes: 3 additions & 3 deletions oauthenticator/oauth2.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ def _logout_redirect_url_default(self):

# Originally a GenericOAuthenticator only trait
basic_auth = Bool(
os.environ.get("OAUTH2_BASIC_AUTH", "False").lower() in {"false", "0"},
os.environ.get("OAUTH2_BASIC_AUTH", "False").lower() in {"true", "1"},
config=True,
help="Whether or not to use basic authentication for access token request",
)
Expand Down Expand Up @@ -534,7 +534,7 @@ def build_token_info_request_headers(self):
"""
headers = {"Accept": "application/json", "User-Agent": "JupyterHub"}

if not self.basic_auth:
if self.basic_auth:
b64key = base64.b64encode(
bytes("{self.client_id}:{self.client_secret}", "utf8")
)
Expand Down Expand Up @@ -610,7 +610,7 @@ def build_access_tokens_request_params(self, handler, data=None):
# the client_id and client_secret should not be included in the access token request params
# when basic authentication is used
# ref: https://www.rfc-editor.org/rfc/rfc6749#section-2.3.1
if self.basic_auth:
if not self.basic_auth:
params.update(
[("client_id", self.client_id), ("client_secret", self.client_secret)]
)
Expand Down