Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
from flet.version import version
from flet_core.locks import AsyncNopeLock, NopeLock
from flet_core.utils import is_asyncio
from oauthlib.oauth2 import WebApplicationClient
from oauthlib.oauth2.rfc6749.tokens import OAuth2Token

from flet_runtime.auth.oauth_provider import OAuthProvider
from flet_runtime.auth.oauth_token import OAuthToken
from flet_runtime.auth.user import User
from oauthlib.oauth2 import WebApplicationClient
from oauthlib.oauth2.rfc6749.tokens import OAuth2Token


class Authorization:
Expand Down Expand Up @@ -76,6 +77,8 @@ def get_authorization_data(self) -> Tuple[str, str]:
self.provider.redirect_url,
scope=self.scope,
state=self.state,
code_challenge=self.provider.code_challenge,
code_challenge_method=self.provider.code_challenge_method,
)
return authorization_url, self.state

Expand Down Expand Up @@ -106,6 +109,7 @@ def __get_request_token_request(self, code: str):
redirect_uri=self.provider.redirect_url,
client_secret=self.provider.client_secret,
include_client_id=True,
code_verifier=self.provider.code_verifier,
)
headers = self.__get_default_headers()
headers["content-type"] = "application/x-www-form-urlencoded"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ def __init__(
user_endpoint: Optional[str] = None,
user_id_fn: Optional[Callable] = None,
group_scopes: Optional[List[str]] = None,
code_challenge: Optional[str] = None,
code_challenge_method: Optional[str] = None,
code_verifier: Optional[str] = None,
) -> None:
self.client_id = client_id
self.client_secret = client_secret
Expand All @@ -28,6 +31,9 @@ def __init__(
self.user_endpoint = user_endpoint
self.user_id_fn = user_id_fn
self.group_scopes = group_scopes if group_scopes is not None else []
self.code_challenge = code_challenge
self.code_challenge_method = code_challenge_method
self.code_verifier = code_verifier

def _name(self):
raise Exception("Not implemented")
Expand Down