diff --git a/fastapi_msal/auth.py b/fastapi_msal/auth.py index 499ad26..20a2062 100644 --- a/fastapi_msal/auth.py +++ b/fastapi_msal/auth.py @@ -62,7 +62,10 @@ async def _login_route( if client_id: print(client_id) if not redirect_uri: - redirect_uri = str(request.url_for("_get_token_route")) + if self.handler.client_config.redirect_uri: + redirect_uri = self.handler.client_config.redirect_uri + else: + redirect_uri = str(request.url_for("_get_token_route")) return await self.handler.authorize_redirect(request=request, redirec_uri=redirect_uri, state=state) async def _get_token_route(self, request: Request, code: str, state: OptStr) -> RedirectResponse: diff --git a/fastapi_msal/core/msal_client_config.py b/fastapi_msal/core/msal_client_config.py index c965c62..923bf66 100644 --- a/fastapi_msal/core/msal_client_config.py +++ b/fastapi_msal/core/msal_client_config.py @@ -50,6 +50,9 @@ class MSALClientConfig(BaseSettings): logout_path: str = "/_logout_route" show_in_docs: bool = False + # Optional uri for redirect (token path) in cases where the app is behind a reverse proxy (PR #35) + redirect_uri: OptStr = None + # Optional Params for Logging and Telemetry with AAD app_name: OptStr = None app_version: OptStr = None