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

Redirection is not working when two angular apps are involved #7246

Open
1 of 2 tasks
jineshataltera opened this issue Aug 9, 2024 · 0 comments
Open
1 of 2 tasks
Labels
adfs Related to ADFS bug-unconfirmed A reported bug that needs to be investigated and confirmed msal-angular Related to @azure/msal-angular package msal-browser Related to msal-browser package Needs: Attention 👋 Awaiting response from the MSAL.js team public-client Issues regarding PublicClientApplications question Customer is asking for a clarification, use case or information.

Comments

@jineshataltera
Copy link

jineshataltera commented Aug 9, 2024

Core Library

MSAL.js (@azure/msal-browser)

Core Library Version

3.20.0

Wrapper Library

MSAL Angular (@azure/msal-angular)

Wrapper Library Version

3.0.23

Public or Confidential Client?

Public

Description

Hello everyone,

I’m currently facing an issue with the login workflow implementation using MSAL-Angular in a scenario involving two Angular applications. My goal is to create a wrapper for Angular client applications so they don't need to manually implement all the MSAL logic.

Here’s what I’ve done so far:

  • I’ve created an Angular library that initializes the MsalModule and MsalService.
  • This library includes a component that calls the loginRedirect() method within its ngOnInit.
  • I’ve developed another Angular app that serves as a client for this library.
  • In this client app, there’s a login button that triggers the rendering of the library component.
  • Upon clicking the login button, the library component renders successfully and redirects to the ADFS login page.
  • Up to this point, everything works as expected.
  • However, after entering my credentials on the ADFS login page, although the login is successful, the redirection back to my Angular client application (running on http://localhost:4200) does not occur. It stops once it reaches to auth code endpoint with #code & #state attribute.
  • I have specified the above URL as the redirectUri in the configuration and set navigateToLoginRequestUrl to false in the Angular library.

Any assistance or suggestions on resolving this issue would be greatly appreciated!

Thank you in advance for your help.

Error Message

No response

MSAL Logs

No response

Network Trace (Preferrably Fiddler)

  • Sent
  • Pending

MSAL Configuration

auth: {
          clientId: '{CLIENT_ID}',     
          authorityMetadata: '{METADATA}'
          redirectUri: 'http://localhost:4200',
          navigateToLoginRequestUrl: false,
        },
        cache: {
          cacheLocation: "localStorage",
          storeAuthStateInCookie: isIE,
        },

Relevant Code Snippets

auth: {
          clientId: '{CLIENT_ID}',     
          authorityMetadata: '{METADATA}'
          redirectUri: 'http://localhost:4200',
          navigateToLoginRequestUrl: false,
        },
        cache: {
          cacheLocation: "localStorage",
          storeAuthStateInCookie: isIE,
        },

Reproduction Steps

  1. I’ve created an Angular library that initializes the MsalModule and MsalService.
  2. This library includes a component that calls the loginRedirect() method within its ngOnInit.
  3. I’ve developed another Angular app that serves as a client for this library.
  4. In this client app, there’s a login button that triggers the rendering of the library component.
  5. Upon clicking the login button, the library component renders successfully and redirects to the ADFS login page.
  6. Up to this point, everything works as expected.
  7. However, after entering my credentials on the ADFS login page, although the login is successful, the redirection back to my Angular client application (running on http://localhost:4200) does not occur. It stops once it reaches to auth code endpoint with #code & #state attribute.
  8. I have specified the above URL as the redirectUri in the configuration and set navigateToLoginRequestUrl to false in the Angular library.

Expected Behavior

After successful login, redirection should be done to my angular client application with token response.

Identity Provider

ADFS

Browsers Affected (Select all that apply)

Chrome, Firefox, Edge, Safari, Other

Regression

No response

Source

Internal (Microsoft)

@jineshataltera jineshataltera added bug-unconfirmed A reported bug that needs to be investigated and confirmed question Customer is asking for a clarification, use case or information. labels Aug 9, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs: Attention 👋 Awaiting response from the MSAL.js team label Aug 9, 2024
@github-actions github-actions bot added adfs Related to ADFS msal-angular Related to @azure/msal-angular package msal-browser Related to msal-browser package public-client Issues regarding PublicClientApplications labels Aug 9, 2024
@jineshataltera jineshataltera changed the title Redirection is not working when two angular apps is involved Redirection is not working when two angular apps are involved Aug 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
adfs Related to ADFS bug-unconfirmed A reported bug that needs to be investigated and confirmed msal-angular Related to @azure/msal-angular package msal-browser Related to msal-browser package Needs: Attention 👋 Awaiting response from the MSAL.js team 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

1 participant