Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sattvikc committed Dec 12, 2024
1 parent d8dd684 commit fc42477
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
10 changes: 5 additions & 5 deletions supertokens_python/recipe/oauth2provider/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,12 @@ def from_json(json: Dict[str, Any]):
def to_json(self) -> Dict[str, Any]:
return {
"status": "OK",
"accessToken": self.access_token,
"expiresIn": self.expires_in,
"idToken": self.id_token,
"refreshToken": self.refresh_token,
"access_token": self.access_token,
"expires_in": self.expires_in,
"id_token": self.id_token,
"refresh_token": self.refresh_token,
"scope": self.scope,
"tokenType": self.token_type,
"token_type": self.token_type,
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,6 @@ async def token_exchange(
request_body = {
"iss": await OpenIdRecipe.get_issuer(user_context),
"inputBody": body,
"authorizationHeader": authorization_header,
}

if body.get("grant_type") == "password":
Expand Down Expand Up @@ -846,7 +845,7 @@ async def introspect_token(
# If it fails, the token is not active, and we return early
if is_access_token:
try:
await self.validate_oauth2_access_token(
payload = await self.validate_oauth2_access_token(
token=token,
requirements=(
OAuth2TokenValidationRequirements(scopes=scopes)
Expand All @@ -856,17 +855,19 @@ async def introspect_token(
check_database=False,
user_context=user_context,
)
return ActiveTokenResponse(payload=payload)
except Exception:
return InactiveTokenResponse()

# For tokens that passed local validation or if it's a refresh token,
# validate the token with the database by calling the core introspection endpoint
request_body = {"token": token}
if scopes:
request_body["scope"] = " ".join(scopes)

res = await self.querier.send_post_request(
NormalisedURLPath("/recipe/oauth/introspect"),
{
"token": token,
"scope": " ".join(scopes) if scopes else None,
},
request_body,
user_context=user_context,
)

Expand Down

0 comments on commit fc42477

Please sign in to comment.