microsoft-authentication-library-for-js: @azure/msal-angular@1.0.0-alpha.0 can't log in

I’m submitting a…


[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Other... Please describe:

Browser:

  • Chrome version XX
  • Firefox version XX
  • IE version XX
  • Edge version XX
  • Safari version XX
  • All

Library version


Library version: 1.0.0-alpha.0

Current behavior

Using loginRedirect to make login request results in the following error in the console, and not able to login.

No redirect callbacks have been set. Please call handleRedirectCallback() with the appropriate function arguments before continuing.

Expected behavior

Using loginRedirect should work by redirectCallbacksSet being set to true on the UserAgentApplication / MsalService instance when the redirect callback is defined in the config object.

Minimal reproduction of the problem with instructions

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 20 (9 by maintainers)

Most upvoted comments

@jakehockey10 As noted in the message, if you use the redirect functions, you need to set handleRedirectCallback to a callback function (execute on page load, everytime) which your application uses to process the result of the operation (i.e. similar to the .then on the popup operations).

Here’s an example from the sample app: https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev-angular-1.0-msal-1/samples/MSALAngularDemoApp/src/app/app.component.ts#L63

Try adding that and let me know if it works.

Looks like I missed explaining this in the readme, so I’ll make sure it gets added. Thanks!

@kaeh Currently, if you use one of the redirect methods, you are required to implement this.authService.handleRedirectCallback. Thanks to #1358, this will no longer be required.

For now, you should implement that function, and the error will go away. Example: https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/samples/angular8-sample-app/src/app/app.component.ts#L27

I still have an error 😕

my package.json have

"@azure/msal-angular": "1.0.0-beta.4",
"msal": "^1.2.2-beta2",

My app.module have

MsalModule.forRoot({
            auth: {
                clientId: "XXX-XXX-XXX",
                redirectUri: window.location.origin + "/home",
                navigateToLoginRequestUrl: true
            },
            cache: {
                cacheLocation: "localStorage"
            },
            framework: {
                isAngular: true
            }
        })

And i have this issue when i should be redirected

ERROR Error: "Uncaught (in promise): ClientConfigurationError: No redirect callbacks have been set. Please call handleRedirectCallback() with the appropriate function arguments before continuing. More information is available here: https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/MSAL-basics.