AzureAD / azure-activedirectory-library-for-js

The code for ADAL.js and ADAL Angular has been moved to the MSAL.js repo. Please open any issues or PRs at the link below.
https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/maintenance/adal-angular
Apache License 2.0
627 stars 374 forks source link

Cannot read property 'getRequestInfo' of null #768

Closed daoodk closed 4 years ago

daoodk commented 6 years ago

Found in AdalJS v1.0.17

Uncaught TypeError: Cannot read property 'getRequestInfo' of null at AuthenticationContext.handleWindowCallback (adal.js:1324)

At line 1315, this._openedWindows.length === 0. At line 1320, windows.parent._adalInstance is undefined.

Neither the if, nor the else if condition is met above, so 'self' remains null.

Line 1324 calls self.getRequestInfo(hash) which fails.

Interestingly, this.getRequestInfo(hash) returns a valid object at this point.

nehaagrawal commented 6 years ago

@daoodk Please give us details about your use case and steps to reproduce. It's hard reproduce this issue by just looking at this error.

ghost commented 6 years ago

@nehaagrawal, I am encountering the same error whenever executing handleWindowCallback() from an iFrame.

It appears that the problem is in AuthenticationContext.prototype.handleWindowCallback where the default value for the variable 'self' is set to null. In all other areas in the library, it is defaulted to 'this' instead. Changing to 'this' in my local copy resolved the issue.

ghost commented 5 years ago

@nehaagrawal, I believe the details provided above should provide the information you need to reproduce/investigate/resolve. Please advise if any additional information is required.

jmckennon commented 4 years ago

All current authentication work from Microsoft is delivered through the msal js library here. adal js is still supported only for security fixes. We recommend moving to msal js for any advanced feature requests and bugfixes.