Skip to content

Commit

Permalink
Merge pull request #35 from colivi/master
Browse files Browse the repository at this point in the history
provide opportunity to declare redirect_uri from config
  • Loading branch information
dudil authored Apr 2, 2024
2 parents 2164bb5 + 1caf517 commit 8c5a40a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion fastapi_msal/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 3 additions & 0 deletions fastapi_msal/core/msal_client_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8c5a40a

Please sign in to comment.