Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion backend/api/auth/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
client_kwargs={"scope": "openid profile email"},
)


@router.post("/token", response_model=Token)
async def login_for_access_token(
form_data: OAuth2PasswordRequestForm = Depends(),
Expand Down Expand Up @@ -83,13 +84,17 @@ async def login(login_data: LoginRequest) -> Any:

return {"access_token": access_token, "token_type": "Bearer"}


@router.get("/microsoft-sso")
async def login_microsoft_sso(request: StarletteRequest, lang: str):
"""
Start Microsoft OAuth2 flow by redirecting the user to Microsoft login.
"""
request.session["lang"] = lang
return await oauth.microsoft.authorize_redirect(request, f"{settings.API_URL}/api/auth/sso-authorize")
return await oauth.microsoft.authorize_redirect(
request, f"{settings.API_URL}/api/auth/sso-authorize"
)


@router.get("/sso-authorize")
async def microsoft_authorize(request: StarletteRequest):
Expand Down Expand Up @@ -122,6 +127,7 @@ async def microsoft_authorize(request: StarletteRequest):
detail="Error during Microsoft OAuth callback",
)


@router.post("/register", response_model=UserRead)
async def register_user(register_data: RegisterRequest) -> Any:
"""
Expand Down
Loading