Skip to content

Commit a024ec3

Browse files
committed
Fix OAuth2 session lifecycle
1 parent f375e63 commit a024ec3

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

images/dashboard/src/routes/login_routes.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@
3838

3939
domain = os.getenv("SANDBOX_DOMAIN")
4040

41-
oauth = OAuth2Session(client_id=client_id, redirect_uri=redirect_uri, scope=osm_instance_scopes)
42-
43-
4441
# Custom static files to set cache control
4542
class CustomStaticFiles(StaticFiles):
4643
async def get_response(self, path: str, scope):
@@ -112,10 +109,10 @@ async def redirect_sandbox(request: Request, code: str, state: str = None, db: S
112109

113110
try:
114111
# Get user data
115-
token = oauth.fetch_token(
112+
oauth = OAuth2Session(client_id=client_id, redirect_uri=redirect_uri, scope=osm_instance_scopes)
113+
oauth.fetch_token(
116114
f"{osm_instance_url}/oauth2/token", code=code, client_secret=client_secret
117115
)
118-
oauth.token = token
119116
user_details_response = oauth.get(f"{osm_instance_url}/api/0.6/user/details.json")
120117
user_details = user_details_response.json()
121118
display_name = user_details.get("user").get("display_name")

0 commit comments

Comments
 (0)