diff --git a/supertokens_python/recipe/oauth2provider/api/auth.py b/supertokens_python/recipe/oauth2provider/api/auth.py index 5b5767e6..8db3e7eb 100644 --- a/supertokens_python/recipe/oauth2provider/api/auth.py +++ b/supertokens_python/recipe/oauth2provider/api/auth.py @@ -86,7 +86,7 @@ async def auth_get( httponly=morsel.get("httponly", True), expires=datetime.strptime(morsel.get("expires", ""), "%a, %d %b %Y %H:%M:%S %Z").timestamp() * 1000, # type: ignore path=morsel.get("path", "/"), - samesite=morsel.get("samesite", "lax"), + samesite=morsel.get("samesite", "lax").lower(), ) return api_options.response.redirect(response.redirect_to) elif isinstance(response, ErrorOAuth2Response): diff --git a/supertokens_python/recipe/oauth2provider/api/login.py b/supertokens_python/recipe/oauth2provider/api/login.py index d080211f..a4d3e181 100644 --- a/supertokens_python/recipe/oauth2provider/api/login.py +++ b/supertokens_python/recipe/oauth2provider/api/login.py @@ -88,7 +88,7 @@ async def login( httponly=morsel.get("httponly", True), expires=datetime.strptime(morsel.get("expires", ""), "%a, %d %b %Y %H:%M:%S %Z").timestamp() * 1000, # type: ignore path=morsel.get("path", "/"), - samesite=morsel.get("samesite", "lax"), + samesite=morsel.get("samesite", "lax").lower(), ) return send_200_response( diff --git a/supertokens_python/recipe/oauth2provider/recipe_implementation.py b/supertokens_python/recipe/oauth2provider/recipe_implementation.py index a3252e22..d2a82f50 100644 --- a/supertokens_python/recipe/oauth2provider/recipe_implementation.py +++ b/supertokens_python/recipe/oauth2provider/recipe_implementation.py @@ -310,14 +310,16 @@ async def authorization( payloads = {"idToken": id_token, "accessToken": access_token} + request_body = { + "params": {**params, "scope": " ".join(scopes)}, + "iss": await OpenIdRecipe.get_issuer(user_context), + "session": payloads, + } + if cookies is not None: + request_body["cookies"] = cookies resp = await self.querier.send_post_request( NormalisedURLPath("/recipe/oauth/auth"), - { - "params": {**params, "scope": " ".join(scopes)}, - "iss": await OpenIdRecipe.get_issuer(user_context), - "cookies": cookies, - "session": payloads, - }, + request_body, user_context, )