syncweek-react-aad / react-aad

A React wrapper for Azure AD using the Microsoft Authentication Library (MSAL). The easiest way to integrate AzureAD with your React for authentication.
MIT License
344 stars 94 forks source link

getAccessToken throws "TypeError: Cannot read property 'tokenType' of undefined" when third party cookies are blocked #246

Open orlahowell opened 4 years ago

orlahowell commented 4 years ago

Library versions

Describe the bug When third party cookies are blocked, I receive an error when using getAccessToken:

"TypeError: Cannot read property 'tokenType' of undefined at new AccessTokenResponse (AccessTokenResponse.js:42) at _callee2$ (MsalAuthProvider.js:373) at tryCatch (runtime.js:45) at Generator.invoke [as _invoke] (runtime.js:265) at Generator.prototype. [as next] (runtime.js:98) at asyncGeneratorStep (MsalAuthProvider.js:72) at _next (MsalAuthProvider.js:94)"

Expected behavior I would expect that acquireTokenSilent would run, return an error and then acquireTokenPopup or acquireTokenRedirect would run.

To Reproduce Steps to reproduce the behavior:

  1. Block third party cookies on chrome
  2. call 'getAccessToken'
  3. See error

Desktop (please complete the following information):

ashtmMSFT commented 4 years ago

I see this error too when third party cookies are blocked. I noticed an issue has already been filed for the underlying MSAL library:

https://github.com/AzureAD/microsoft-authentication-library-for-js/issues/1880

ejdoh1 commented 4 years ago

I hit this using Google Incognito

SubhasisDebsharma commented 4 years ago

Happens when the third party cookies are blocked

GraemeF commented 4 years ago

Should be resolved by #238