Token not available after redirect
See original GitHub issuePlease follow the issue template below. Failure to do so will result in a delay in answering your question.
Library
-
msal@1.x.x
or@azure/msal@1.x.x
-
@azure/msal-browser@ 2.0.0-beta.0
-
@azure/msal-angular@0.x.x
-
@azure/msal-angular@1.x.x
-
@azure/msal-angularjs@1.x.x
Description
I’m using React framework.
When I login using loginRedirect()
method, I get redirected back to the redirect uri I had provided - https:localhost:3000
.
After the redirect (back into my page) when componentDidMount()
is called, msalInstance.getAccount()
returns null
as token hasn’t been created yet.
After this the redirect callback is triggered.
componentDidMount()
gets called before Trigger of redirect callback and token creation.
Hence I have to reload the page after the redirection so that msalInstance.getAccount()
present inside componentDidMount()
works.
How can I handle this or is it a bug?
I was using msal v1.3.0
and I didn’t use to get this issue.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (1 by maintainers)
Top GitHub Comments
@ktikku This behavior should be fixed by #1490 and will be included in the next release. @pkanher617 can share more info about when this might be available on npm
hi @ktikku how do you resolved the issue using
handleRedirectPromise
. I’m having issues after I login and it didn’t go back to myhandleRedirectPromise
but instead go straight to mycomponentDidMount
.