AzureAD / microsoft-authentication-library-for-js

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

[MSAL Angular] Error thrown while acquiring the token #3314

Closed Madhufuture closed 3 years ago

Madhufuture commented 3 years ago

Library

Framework

Description

We have updated our SPA app ng version from ng8 to ng9. We were using below libraries mentioned above in ng8. After upgrading the ng version, no other code changes we are consistently getting below errors.

Do we need to update the MSAL and MSAL Angular packages?

Error Message

1) DOMException: Failed to set the 'domain' property on 'Document': Assignment is forbidden for sandboxed iframes. 2) Error: Uncaught (in promise): Error: Cannot match any routes. URL Segment: 'state'

MSAL Configuration

const auth = {
    auth: {
        clientId:
        authority:
        validateAuthority:
        redirectUri:
        postLogoutRedirectUri:
        navigateToLoginRequestUrl:
    },
    cache {
        cacheLocation: 'sessionStorage'
    },
    system: {
        logger:
        loadFrameTimeout: 20000,
        windowHashTimeout: 20000,
        iframeHashTimeout: 20000
    }
}

return (auth as Configuration)

Browsers/Environment

sameerag commented 3 years ago

@Madhufuture did you consider moving to msal 2.x which will give you access to the latest angular package from our end? A good starting point for migration docs can be found here.

@jo-arroyo can help with the migration if you need more info.

Madhufuture commented 3 years ago

@sameerag no we don't have any plans to migrate to MSAL 2.x. We will be sticking with msal 1.x until July.

Madhufuture commented 3 years ago

@jasonnutter , Could you please suggest us any other solution apart from moving to MSAL 2.x?

jasonnutter commented 3 years ago

DOMException: Failed to set the 'domain' property on 'Document': Assignment is forbidden for sandboxed iframes.

This is likely due to your app being throttled for making too many requests in a short period of time. Please provide correlation IDs (and timestamps) so we can look up server logs to confirm.

Error: Uncaught (in promise): Error: Cannot match any routes. URL Segment: 'state'

Are you using hash routing? If so, you should add routes for keywords that appear in MSAL responses (e.g. state, access_token, error, etc).

github-actions[bot] commented 3 years ago

This issue has not seen activity in 14 days. If your issue has not been resolved please leave a comment to keep this open. It will be closed in 7 days if it remains stale.

hectormmg commented 3 years ago

Closing due to inactivity. Please let us know if this is still an issue.