1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

How to navigate desired URL after Azure AD Login using MSAL angular

Discussão em 'Angular' iniciado por MallikarjunaReddy, Outubro 9, 2024.

  1. We are using Azure AD Authentication to validate users using MSAL after successful verification it is navigating to configured redirect URL

    For example:

    redirect URL: http://localhost:4200/ (Configured in App registration under Azure portal as Single Page Application) Here it will navigate azure ad login page after successful login it will navigate to above redirect URL.

    Problem: Now if user is trying to access specific URL as mentioned below (If user is not authenticated)

    http://localhost:4200/data/100

    User should authenticate using Azure AD -> after successful authenticate it should navigate to user requested URL for example above URL (http://localhost:4200/data/100), But it always going to configured redirect URL i.e. http://localhost:4200.

    How to handle this type of scenario to navigate to desired URL?

    `export function MSALInstanceFactory(): IPublicClientApplication {
    return new PublicClientApplication({
    auth: {
    clientId: environment.clientId,
    authority: `https://login.microsoftonline.com/tenatId`,
    redirectUri: 'http://localhost:4200',
    postLogoutRedirectUri: 'http://localhost:4200'
    },
    cache: {
    cacheLocation: BrowserCacheLocation.SessionStorage,
    storeAuthStateInCookie: isIE, // set to true for IE 11
    }
    });
    }`

    Continue reading...

Compartilhe esta Página