Skip to content

Commit f9bea71

Browse files
authored
Merge pull request #14 from auth0-samples/Annyv2-patch-1
Hardcode algorithm
2 parents cc3a0ff + a12c566 commit f9bea71

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

00-Starter-Seed/server.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
load_dotenv(path.join(path.dirname(__file__), ".env"))
1515
AUTH0_DOMAIN = env["AUTH0_DOMAIN"]
1616
API_AUDIENCE = env["API_ID"]
17-
17+
ALGORITHMS = ["RS256"]
1818
APP = 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)

0 commit comments

Comments
 (0)