Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MsalGuard redirect to login instead of automatically authenticating? #7257

Closed
umagon opened this issue Aug 14, 2024 · 1 comment
Closed

MsalGuard redirect to login instead of automatically authenticating? #7257

umagon opened this issue Aug 14, 2024 · 1 comment
Labels
feature-unconfirmed msal-angular Related to @azure/msal-angular package msal-browser Related to msal-browser package public-client Issues regarding PublicClientApplications question Customer is asking for a clarification, use case or information.

Comments

@umagon
Copy link

umagon commented Aug 14, 2024

Core Library

MSAL.js (@azure/msal-browser)

Wrapper Library

MSAL Angular (@azure/msal-angular)

Public or Confidential Client?

Public

Description

I was checking this issue #3047 and the OP wanted to login automatically upon entering a protected path.

I want the opposite, I would like MsalGuard to redirect to my login page instead of trying to automatically authenticate (thus triggering a msal:loginStart event) upon arrival to a protected route. I only want the app to try to authenticate when the user clicks on my "SSO Login" button.

My Setup

PathLocationStrategy, MsalRedirectComponent (bootstrapped in app.module) in its own /auth route, with its tag present in index.html. Login page with a button that calls loginRedirect(). Using logoutRedirect({ account }) to logout with postLogoutRedirectUri to my login page, MsalGuard protecting all routes except /auth, /login and error pages, RoleGuard protecting certain screens.

Source

External (Customer)

@umagon umagon added feature-unconfirmed question Customer is asking for a clarification, use case or information. labels Aug 14, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs: Attention 👋 Awaiting response from the MSAL.js team label Aug 14, 2024
@github-actions github-actions bot added msal-angular Related to @azure/msal-angular package msal-browser Related to msal-browser package public-client Issues regarding PublicClientApplications labels Aug 14, 2024
@tnorling
Copy link
Collaborator

This is more of a routing problem than an auth problem so this is not something we're going to build into the library, however, you can absolutely build your own Guard to handle this.

@microsoft-github-policy-service microsoft-github-policy-service bot removed the Needs: Attention 👋 Awaiting response from the MSAL.js team label Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-unconfirmed msal-angular Related to @azure/msal-angular package msal-browser Related to msal-browser package public-client Issues regarding PublicClientApplications question Customer is asking for a clarification, use case or information.
Projects
None yet
Development

No branches or pull requests

2 participants