diff --git a/v2/microservice_auth/client-credentials.mdx b/v2/microservice_auth/client-credentials.mdx index 9af2981ad..d0d433e7f 100644 --- a/v2/microservice_auth/client-credentials.mdx +++ b/v2/microservice_auth/client-credentials.mdx @@ -351,7 +351,6 @@ You can use the [PyJWT](https://github.com/jpadilla/pyjwt) library to verify the ```python from typing import Optional, List -import requests import jwt from jwt import PyJWKClient @@ -379,11 +378,11 @@ def validate_token(token: str) -> bool: return False scopes: List[str] = decoded.get('scp', []) - if not isinstance(scopes, list) or required_scope not in scopes: + if required_scope not in scopes: return False return True - except Exception as e: + except Exception: return False ``` diff --git a/v2/unified-login/customizations/verify-tokens.mdx b/v2/unified-login/customizations/verify-tokens.mdx index 30c4f9af7..9da9d6265 100644 --- a/v2/unified-login/customizations/verify-tokens.mdx +++ b/v2/unified-login/customizations/verify-tokens.mdx @@ -158,7 +158,6 @@ You can use the [PyJWT](https://github.com/jpadilla/pyjwt) library to verify the ```python from typing import Optional, List -import requests import jwt from jwt import PyJWKClient @@ -177,7 +176,6 @@ def validate_token(token: str) -> bool: token, signing_key.key, algorithms=['RS256'], - audience=audience, options={"require": ["stt", "client_id", "scp"]} ) @@ -191,11 +189,11 @@ def validate_token(token: str) -> bool: scopes: List[str] = decoded.get('scp', []) - if not isinstance(scopes, list) or required_scope not in scopes: + if required_scope not in scopes: return False return True - except Exception as e: + except Exception: return False ```