From 1fba51e75d6192c923519eb1d1118f602405cb0d Mon Sep 17 00:00:00 2001 From: Sam Talpey Date: Mon, 5 Feb 2024 13:37:14 -0500 Subject: [PATCH] Resolve typo and change to Literal --- docs/oauth2.md | 2 +- httpx_oauth/clients/franceconnect.py | 4 +++- httpx_oauth/oauth2.py | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/oauth2.md b/docs/oauth2.md index e9c5e57..ba5ee59 100644 --- a/docs/oauth2.md +++ b/docs/oauth2.md @@ -30,7 +30,7 @@ Returns the authorization URL where you should redirect the user to ask for thei * `state: str = None`: Optional string that will be returned back in the callback parameters to allow you to retrieve state information. * `scope: Optional[List[str]] = None`: Optional list of scopes to ask for. * `code_challenge: Optional[str] = None`: Optional code_challenge in a [PKCE context](https://datatracker.ietf.org/doc/html/rfc7636). - * `code_challenge_method: ptional[str] = None`: Optional code_challenge_method in a [PKCE context](https://datatracker.ietf.org/doc/html/rfc7636). + * `code_challenge_method: Optional[Literal["plain", "S256"]] = None`: Optional code_challenge_method in a [PKCE context](https://datatracker.ietf.org/doc/html/rfc7636). * `extras_params: Optional[Dict[str, Any]] = None`: Optional dictionary containing parameters specific to the service. !!! example diff --git a/httpx_oauth/clients/franceconnect.py b/httpx_oauth/clients/franceconnect.py index 54d0557..d89be6b 100644 --- a/httpx_oauth/clients/franceconnect.py +++ b/httpx_oauth/clients/franceconnect.py @@ -1,5 +1,5 @@ import secrets -from typing import Any, Dict, List, Optional, Tuple, TypedDict +from typing import Any, Dict, List, Literal, Optional, Tuple, TypedDict from httpx_oauth.errors import GetIdEmailError from httpx_oauth.oauth2 import BaseOAuth2 @@ -58,6 +58,8 @@ async def get_authorization_url( redirect_uri: str, state: Optional[str] = None, scope: Optional[List[str]] = None, + code_challenge: Optional[str] = None, + code_challenge_method: Optional[Literal["plain", "S256"]] = None, extras_params: Optional[FranceConnectOAuth2AuthorizeParams] = None, ) -> str: _extras_params = extras_params or {} diff --git a/httpx_oauth/oauth2.py b/httpx_oauth/oauth2.py index 8bda589..bfef17e 100644 --- a/httpx_oauth/oauth2.py +++ b/httpx_oauth/oauth2.py @@ -5,6 +5,7 @@ Dict, Generic, List, + Literal, Optional, Tuple, TypeVar, @@ -101,7 +102,7 @@ async def get_authorization_url( state: Optional[str] = None, scope: Optional[List[str]] = None, code_challenge: Optional[str] = None, - code_challenge_method: Optional[str] = None, + code_challenge_method: Optional[Literal["plain", "S256"]] = None, extras_params: Optional[T] = None, ) -> str: params = {