question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Token not available after redirect

See original GitHub issue

Please 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.

image

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
tnorlingcommented, May 5, 2020

@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

0reactions
khloe19commented, Jul 5, 2020

hi @ktikku how do you resolved the issue using handleRedirectPromise. I’m having issues after I login and it didn’t go back to my handleRedirectPromise but instead go straight to my componentDidMount.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Token not received after redirecting from login - Stack Overflow
It works fine with iOS, redirects and returns token back from the login screen. However in case of Android, after redirecting from the...
Read more >
Access token is missing after redirect - Auth0 Community
My application works with Chrome, however when I try to sign in with Safari redirect url doesn't contain hash with access token so ......
Read more >
Azure AD Redirect URL not work after deployed production
I'm using MS Graph API to send alert via MSTeams working for local environment. Using /authorize & /token I'm fetching token and refresh...
Read more >
OAuth redirect after getting access token - the Tyk community
I am not speaking about redirect to login page that is working fine. I am talking about after reaching login, then getting authorisation...
Read more >
OIDC login redirect not working - Okta Developer forums
Everything worked and dev okta was able to redirect to my local box. When my IT team tried to set me up with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found