Skip to content

Commit

Permalink
fix: cyclic import
Browse files Browse the repository at this point in the history
  • Loading branch information
sattvikc committed Dec 30, 2024
1 parent 571dae6 commit 8eb6114
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import jwt

from supertokens_python.normalised_url_path import NormalisedURLPath
from supertokens_python.recipe.accountlinking.recipe import AccountLinkingRecipe
from supertokens_python.recipe.openid.recipe import OpenIdRecipe
from supertokens_python.recipe.session.interfaces import SessionContainer
from supertokens_python.recipe.session.jwks import get_latest_keys
Expand Down Expand Up @@ -236,7 +237,6 @@ async def authorization(
session: Optional[SessionContainer],
user_context: Dict[str, Any],
) -> Union[RedirectResponse, ErrorOAuth2Response]:
from supertokens_python.asyncio import get_user

# we handle this in the backend SDK level
if params.get("prompt") == "none":
Expand Down Expand Up @@ -284,7 +284,9 @@ async def authorization(

client = client_info.client

user = await get_user(session.get_user_id())
user = await AccountLinkingRecipe.get_instance().recipe_implementation.get_user(
user_id=session.get_user_id(), user_context=user_context
)
if not user:
return ErrorOAuth2Response(
status_code=400,
Expand Down Expand Up @@ -392,8 +394,6 @@ async def token_exchange(
body: Dict[str, Optional[str]],
user_context: Dict[str, Any],
) -> Union[TokenInfoResponse, ErrorOAuth2Response]:
from supertokens_python.asyncio import get_user

request_body = {
"iss": await OpenIdRecipe.get_issuer(user_context),
"inputBody": body,
Expand Down Expand Up @@ -476,7 +476,9 @@ async def token_exchange(
)

client = client_info.client
user = await get_user(token_info.payload["sub"])
user = await AccountLinkingRecipe.get_instance().recipe_implementation.get_user(
user_id=token_info.payload["sub"], user_context=user_context
)

if not user:
return ErrorOAuth2Response(
Expand Down

0 comments on commit 8eb6114

Please sign in to comment.