marmelab / ra-auth-msal

An auth provider for react-admin which handles authentication using the MSAL
MIT License
4 stars 3 forks source link

Redirect loop in Edge #12

Closed dicksnel closed 4 months ago

dicksnel commented 11 months ago

In version 1.2.0 a redirect loop is introduced.

It seems to only happens in Edge. After redirecting back to /auth-login, the application initiates another redirect to fetch a token, causing a loop. This does not happen in Firefox.

Reverting to 1.1.0 fixes the issues.

image

slax57 commented 10 months ago

Thanks for this feedback. Until we can investigate further, note that the feature that was introduced in 1.2.0 (which likely causes the issue) can be disabled by setting enableDeepLinkRedirect to false.

jonathan-marmelab commented 10 months ago

Hello @dicksnel,

I am the developper that implemented the deep link feature. I wasn't able to reproduce the bug on Edge (Linux), can you give me more information about your setup ?

It seems that there is an error on the Microsoft token enpoint on your logs, can you give me more information about this error as well ?

Have a nice day, Jonathan

dicksnel commented 10 months ago

@jonathan-marmelab I changed my implementation from:

const myMSALObj = new PublicClientApplication(msalConfig);

To:

const myMSALObj = new PublicClientApplication(msalConfig);
myMSALObj.initialize().then(() => {}});

Which seems to have fixed the issue. The demo project mentions:

[https://github.com/marmelab/ra-auth-msal/blob/main/packages/demo-react-admin/src/App.tsx

const myMSALObj = new PublicClientApplication(msalConfig);](https://github.com/marmelab/ra-auth-msal/blob/706d7f477309e50d117391b16989c3a834e49d3f/packages/demo-react-admin/src/App.tsx#L36C7-L36C7)

But this is deprecated. Newer versions of MSAL require async initialization.

Thank for the help!

dicksnel commented 10 months ago

I made a mistake and was still running the old version. The issues is not fixed. But setting enableDeepLinkRedirect to false does work as a temporary fix.

slax57 commented 10 months ago

Thanks for the additional information.

I'll reopen the issue then.

Can you please specify what version of @azure/msal-browser shows the issue, and what version does not?

Thanks.

djhi commented 5 months ago

I can't reproduce this error using our demo with MS Entra. I'm using Edge on Linux though.

fzaninotto commented 4 months ago

I'm closing this issue because we got no news for some time. Feel free to add a "how to reproduce" comment if you want us to take a look at it.