Closed architect-tarun-narang closed 3 years ago
@architect-tarun-narang This error is probably not stemming from the graph endpoint call, but from the angular interceptor which is attempting to call acquireTokenInteractive again. Could you give us more information about how the redirection code is working? A code snippet would be helpful. This usually happens if the redirection from the login page is not being handled correctly.
The code has been shared on the git repository for your reference
There is an auth-config.json file at path "src/app" where you may need to update the clientID and TenantID to make it work.
In appmodule.ts file, the below code returns the token at the redirect uri, this code is called when the URL is requested.
As suggested by you, if this is a case where redirection from the login page is not handled correctly then the same code base should not work when its point to the TenantID and the ClientID created from developer's account (Test Accounts) used at the time of development. May be test account credentials are cached in the browser and now pointing it to different clientId is not updating the cache and throwing this error.
I have the same problem when using InteractionType.Redirect
, but with InteractionType.PopUp
everything works fine.
Maybe this helps to narrow down the problem.
Thanks, I give it a try with InteractionType.PopUp but it lands me to some different errors which I will have a look.
@ursmeier-mercatus - after updating to nteractionType.PopUp, it worked. I did not face the original reported error. However, I am not sure why, I am being redirected to login popup every time I click on a different URL/request. Should not the token be saved in a browser cache/cookies. Am I missing something?
I tried it with the beta.0 version and still the same behaviour, so I searched some more and found the issue. Popup
Redirect
bootstrap: [AppComponent, MsalRedirectComponent]
and adding <app-redirect></app-redirect>
to index.html resolved the issue for meConclusion
https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-angular/docs/v2-docs/1.x-2.x-upgrade-guide.md says the we should use MsalRedirectComponent
.
It was not aware that using MsalRedirectComponent
/subscribing to handleRedirectObservable
is compulsory.
Maybe this can be made even more understandable in the documentation.
Hope this helps.
Thanks for your detailed response, I will give it a try in a day or two and revert.
InteractionType.PopUp worked fine and afterwards this error did not appear. Thanks
@architect-tarun-narang Thanks for letting us know that worked! Can this issue be closed?
@ursmeier-mercatus Thanks for the feedback, we will certainly make a note to update the docs to make this more clear.
Library
@azure/msal-browser@2.11.1
@azure/msal-angular@2.0.0-alpha.5
Framework
Description
Reproduction Steps
Calling Function
Error Message
MSAL Configuration
There is no extra configuration except this function which is added in app-module.ts
Reproduction steps
Expected behavior
User's information must be retrieved.
Identity Provider
Browsers/Environment
Regression