Skip to content

Commit 2d460a2

Browse files
committed
Implement feedback from @adamjmcgrath
1 parent 333110a commit 2d460a2

File tree

2 files changed

+3
-14
lines changed

2 files changed

+3
-14
lines changed

01-Login/.env.example

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
AUTH0_CLIENT_ID={CLIENT_ID}
22
AUTH0_DOMAIN={DOMAIN}
3-
AUTH0_AUDIENCE=
43
APP_SECRET_KEY=ALongRandomlyGeneratedString

01-Login/server.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77

88
from authlib.integrations.flask_client import OAuth
99
from dotenv import find_dotenv, load_dotenv
10-
from flask import Flask, jsonify, redirect, render_template, session, url_for
11-
from werkzeug.exceptions import HTTPException
10+
from flask import Flask, redirect, render_template, session, url_for
1211

1312
ENV_FILE = find_dotenv()
1413
if ENV_FILE:
@@ -18,11 +17,6 @@
1817
app.secret_key = env.get("APP_SECRET_KEY")
1918

2019

21-
def fetch_token(name, request):
22-
token = OAuth2Token.find(name=name, user=request.user)
23-
return token.to_token()
24-
25-
2620
oauth = OAuth(app)
2721

2822
oauth.register(
@@ -31,10 +25,7 @@ def fetch_token(name, request):
3125
client_kwargs={
3226
"scope": "openid profile email",
3327
},
34-
server_metadata_url="https://"
35-
+ env.get("AUTH0_DOMAIN")
36-
+ "/.well-known/openid-configuration",
37-
fetch_token=fetch_token,
28+
server_metadata_url=f'https://{env.get("AUTH0_DOMAIN")}/.well-known/openid-configuration',
3829
)
3930

4031

@@ -58,8 +49,7 @@ def callback():
5849
@app.route("/login")
5950
def login():
6051
return oauth.auth0.authorize_redirect(
61-
redirect_uri=url_for("callback", _external=True),
62-
audience=env.get("AUTH0_AUDIENCE"),
52+
redirect_uri=url_for("callback", _external=True)
6353
)
6454

6555

0 commit comments

Comments
 (0)