Skip to content

Commit

Permalink
Move checks for code_verifier
Browse files Browse the repository at this point in the history
  • Loading branch information
Perun108 committed Jun 29, 2024
1 parent 8e8ef27 commit c8f36cd
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions google_auth_oauthlib/flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,7 @@ def from_client_config(cls, client_config, scopes, **kwargs):

# these args cannot be passed to requests_oauthlib.OAuth2Session
code_verifier = kwargs.pop("code_verifier", None)
autogenerate_code_verifier = kwargs.pop("autogenerate_code_verifier", None)
if not code_verifier and autogenerate_code_verifier is None:
autogenerate_code_verifier = True
autogenerate_code_verifier = kwargs.pop("autogenerate_code_verifier", True)

(
session,
Expand Down Expand Up @@ -239,7 +237,7 @@ def authorization_url(self, **kwargs):
specify the ``state`` when constructing the :class:`Flow`.
"""
kwargs.setdefault("access_type", "offline")
if self.autogenerate_code_verifier:
if self.code_verifier is None and self.autogenerate_code_verifier:
chars = ascii_letters + digits + "-._~"
rnd = SystemRandom()
random_verifier = [rnd.choice(chars) for _ in range(0, 128)]
Expand Down

0 comments on commit c8f36cd

Please sign in to comment.