File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1414load_dotenv (path .join (path .dirname (__file__ ), ".env" ))
1515AUTH0_DOMAIN = env ["AUTH0_DOMAIN" ]
1616API_AUDIENCE = env ["API_ID" ]
17-
17+ ALGORITHMS = [ "RS256" ]
1818APP = Flask (__name__ )
1919
2020
@@ -99,7 +99,7 @@ def decorated(*args, **kwargs):
9999 payload = jwt .decode (
100100 token ,
101101 rsa_key ,
102- algorithms = unverified_header [ "alg" ] ,
102+ algorithms = ALGORITHMS ,
103103 audience = API_AUDIENCE ,
104104 issuer = "https://" + AUTH0_DOMAIN + "/"
105105 )
@@ -109,11 +109,11 @@ def decorated(*args, **kwargs):
109109 except jwt .JWTClaimsError :
110110 return handle_error ({"code" : "invalid_claims" ,
111111 "description" : "incorrect claims,"
112- "please check the audience and issuer" }, 401 )
112+ " please check the audience and issuer" }, 401 )
113113 except Exception :
114114 return handle_error ({"code" : "invalid_header" ,
115115 "description" : "Unable to parse authentication"
116- "token." }, 400 )
116+ " token." }, 400 )
117117
118118 _app_ctx_stack .top .current_user = payload
119119 return f (* args , ** kwargs )
You can’t perform that action at this time.
0 commit comments