AzureAD / microsoft-authentication-library-for-js

Microsoft Authentication Library (MSAL) for JS
http://aka.ms/aadv2
MIT License
3.64k stars 2.65k forks source link

B2C login loop infinitely, The getRedirectResponseHash method cannot get state value even the B2C response include the value #state=eyJpZ... #6870

Closed LuBu0505 closed 6 months ago

LuBu0505 commented 8 months ago

Core Library

MSAL.js (@azure/msal-browser)

Core Library Version

2.38.3

Wrapper Library

MSAL Angular (@azure/msal-angular)

Wrapper Library Version

2.5.12

Public or Confidential Client?

Public

Description

login use met infinite loop. B2C already return the State value, But the MSAL cannot handler it.

The error condition: image

The Customer modify code part: image

The MSAL SDK version: image

Error Message

No Error show , just infinite loop.

MSAL Logs

The error message is

MSAL.JS.BROWSER@2.38.2: Info - handleRedirectPromise did not detect a response hash as a result of a redirect. Cleaning temporary cache.

image

Network Trace (Preferrably Fiddler)

MSAL Configuration

Reference the Docs: https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/msal-browser-v2.32.3-patch-release/lib/msal-angular/docs/v2-docs/redirects.md 

Part2 : Subscribing to handleRedirectObservable manually

Relevant Code Snippets

NA

Reproduction Steps

NA

Expected Behavior

Login Successfully. and The State have value. Like the below screenshot: image

Identity Provider

Azure B2C Custom Policy

Browsers Affected (Select all that apply)

Chrome, Edge

Regression

No response

Source

External (Customer)

tnorling commented 7 months ago

Something, probably your router, has removed everything after state, you can see this in your URL bar. Unfortunately if the information isn't there MSAL can't handle the response. You'll need to track down where the hash is being changed and stop it from doing so

microsoft-github-policy-service[bot] commented 7 months ago

@LuBu0505 This issue has been automatically marked as stale because it is marked as requiring author feedback but has not had any activity for 5 days. If your issue has been resolved please let us know by closing the issue. If your issue has not been resolved please leave a comment to keep this open. It will be closed automatically in 7 days if it remains stale.