handleRedirectCallback returning null for authErr?
See original GitHub issuePlease follow the issue template below. Failure to do so will result in a delay in answering your question.
Library
-
@azure/msal@1.3.0
-
@azure/msal-browser@2.x.x
-
@azure/msal-angular@0.x.x
-
@azure/msal-angular@1.x.x
-
@azure/msal-angularjs@1.x.x
Important: Please fill in your exact version number above, e.g. msal@1.1.3
.
Framework
If you are using a framework, please provide the framework and version (e.g. Angular v8, React v16, etc).
React 16
Description
type of this.userAgentApp.handleRedirectCallback is: handleRedirectCallback(authCallback: authResponseCallback): void; where authResponseCallback is: export declare type authResponseCallback = (authErr: AuthError, response?: AuthResponse) => void;
I have passed in a callback that fits this signature however, on first time load of the site when user logs in, authErr is null and the site crashes because of a TypeError
^errorCode is a property of AuthError type. Let me know if you need code example
Security
Is this issue security related?
No
Regression
Did this behavior work before?
Not sure
Configuration
Please provide your MSAL configuration options.
// Provide configuration values here.
// For Azure B2C issues, please include your policies.
{
auth: {
clientId: this.clientId,
authority: this.authority,
redirectUri: this.loginRedirectUri,
postLogoutRedirectUri: this.postLogoutRedirectUri
},
cache: {
cacheLocation: "localStorage",
storeAuthStateInCookie: true
},
system: {
logger: new Logger(MsalAuthContext.msalLoggerCallback, { level: LogLevel.Verbose, piiLoggingEnabled: false }),
navigateFrameWait: 0
}
}
Reproduction steps
Not 100% reproducible…
Expected behavior
A clear and concise description of what you expected to happen.
I expect the callback to not be passed a null for authErr in the callback authResponseCallback = (authErr: AuthError, response?: AuthResponse) => void;
Browsers
Is this issue browser-specific? If so, please detail which browsers are impacted (e.g. IE 11, Safari).
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (3 by maintainers)
Top GitHub Comments
authErrorHandler missed the null check, so it’s throwing the same error.
https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/0dbbda42160addfdfb926f0245b702f52009365a/lib/msal-core/src/UserAgentApplication.ts#L313
This will also be more clearly defined in the code when we turn on
strictNullChecks
which we are currently working on