File tree Expand file tree Collapse file tree 2 files changed +2
-9
lines changed Expand file tree Collapse file tree 2 files changed +2
-9
lines changed Original file line number Diff line number Diff line change 11flask
22python-dotenv
3- requests
43authlib
54six
Original file line number Diff line number Diff line change 1414from flask import url_for
1515from authlib .flask .client import OAuth
1616from six .moves .urllib .parse import urlencode
17- import requests
1817
1918import constants
2019
@@ -76,21 +75,16 @@ def home():
7675
7776@app .route ('/callback' )
7877def callback_handling ():
79- resp = auth0 .authorize_access_token ()
80-
81- url = AUTH0_BASE_URL + '/userinfo'
82- headers = {'authorization' : 'Bearer ' + resp ['access_token' ]}
83- resp = requests .get (url , headers = headers )
78+ auth0 .authorize_access_token ()
79+ resp = auth0 .get ('userinfo' )
8480 userinfo = resp .json ()
8581
8682 session [constants .JWT_PAYLOAD ] = userinfo
87-
8883 session [constants .PROFILE_KEY ] = {
8984 'user_id' : userinfo ['sub' ],
9085 'name' : userinfo ['name' ],
9186 'picture' : userinfo ['picture' ]
9287 }
93-
9488 return redirect ('/dashboard' )
9589
9690
You can’t perform that action at this time.
0 commit comments