diff --git a/backend/src/backend/auth/auth_helper.py b/backend/src/backend/auth/auth_helper.py index 5a4bf4af9..eb9ea328f 100644 --- a/backend/src/backend/auth/auth_helper.py +++ b/backend/src/backend/auth/auth_helper.py @@ -34,8 +34,9 @@ async def _login_route(self, request: Request, redirect_url_after_login: Optiona for value in config.RESOURCE_SCOPES_DICT.values(): all_scopes_list.extend(value) - if "CODESPACE_NAME" in os.env: - redirect_uri = f"https://{os.env['CODESPACE_NAME']}-8080.app.github.dev/auth-callback" + if "CODESPACE_NAME" in os.environ: + # Developer is using GitHub codespace, so we use the GitHub codespace provided URL instead of localhost. + redirect_uri = f"https://{os.environ['CODESPACE_NAME']}-8080.app.github.dev/auth-callback" else: redirect_uri = f"http://localhost:8080/auth-callback" diff --git a/docker-compose.yml b/docker-compose.yml index dda1034d3..f6e4e1c56 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -31,6 +31,7 @@ services: - WEBVIZ_SMDA_RESOURCE_SCOPE - WEBVIZ_SMDA_SUBSCRIPTION_KEY - WEBVIZ_SUMO_ENV + - CODESPACE_NAME # Automatically set env. variable by GitHub codespace volumes: - ./backend/src:/home/appuser/backend/src