Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ClientAuthError: Error: could not resolve endpoints. Please check network and try again when not supplying authenticationParameters #691

Closed
5 tasks
Tovli opened this issue May 5, 2019 · 24 comments
Assignees
Labels
b2c Related to Azure B2C library-specific issues bug A problem that needs to be fixed for the feature to function as intended.

Comments

@Tovli
Copy link

Tovli commented May 5, 2019

I'm submitting a...


[x] Regression (a behavior that used to work and stopped working in a new release)
[ ] 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

Library version


Library version: 1.0.0



## Current behavior

When using loginPopup without an AuthenticationParameters parameter then an exception is thrown due to undefined request parameter

## Expected behavior

The loginPopup window should be displayed

## Minimal reproduction of the problem with instructions

Login using this code:
this.app.loginPopup().then(function () {
      return this.app.acquireTokenSilent();
    }).catch(function (error) { return Promise.reject(error) }

    );

@sameerag
Copy link
Member

sameerag commented May 5, 2019

@Tovli Thanks for raising this. loginPopup() should have been working without any request. Will reach out once I debug this.

@sameerag sameerag added bug A problem that needs to be fixed for the feature to function as intended. more-information-needed Use this label when you are waiting on information from the issue creator and removed bug A problem that needs to be fixed for the feature to function as intended. labels May 5, 2019
@sameerag
Copy link
Member

sameerag commented May 5, 2019

@Tovli I just tested this and it works as expected. loginPopup() works without a parameter. From the error you posted I do see that this error could be thrown if the endPoint verification is failing. Can you please send us the authority that you are using to make this call?

We make a call to the end point before sending a real request to the service to ensure that it is a reachable and valid. A call is made to Open-Id well known configuration and any failure in this path causes the above error: "Error: could not resolve endpoints."

@Tovli
Copy link
Author

Tovli commented May 5, 2019 via email

@sameerag sameerag closed this as completed May 5, 2019
@Tovli
Copy link
Author

Tovli commented May 5, 2019 via email

@sameerag
Copy link
Member

sameerag commented May 5, 2019

Yes. loginPopup() and logonRedirect() work without any inputs, they give you an idToken with scopes as "clientId". acquireToken() calls need 'scopes' as parameters.

Any failure in the i/p parameters in config(if authority is set there - or during app registration) is thrown to the user before we proceed with the authentication.

@Tovli
Copy link
Author

Tovli commented May 5, 2019 via email

@sameerag
Copy link
Member

sameerag commented May 5, 2019

oh! Sorry I misunderstood you too. I thought passing the right authority in 'configuration' solved your issue. Are you saying if the authority in configuration is correct and you are making a loginPopup() request without any parameters, are you still failing?

@Tovli
Copy link
Author

Tovli commented May 5, 2019 via email

@Tovli
Copy link
Author

Tovli commented May 6, 2019

Hi
I've cloned msal B2C sample and all I've changed was this line:
clientApplication.loginPopup(loginRequest).then(function (loginResponse) {
to:
clientApplication.loginPopup().then(function (loginResponse) {

My workaround was to create a login request with authority and pass it to the login popup:

var loginRequest = {
        authority: "https://login.microsoftonline.com/tfp/fabrikamb2c.onmicrosoft.com/b2c_1_susi"
      };

Hope that clarify the issue

@Tovli
Copy link
Author

Tovli commented May 8, 2019

@sameerag ?

@sameerag
Copy link
Member

sameerag commented May 8, 2019

@Tovli I ack your response. I will try to reach out this/next week on this once I check with the B2C service team. I have tested with MSA and it works without 'authority' and hence I suspect the B2C flow issue in this case.

@sameerag sameerag reopened this May 8, 2019
@sameerag sameerag added b2c Related to Azure B2C library-specific issues bug A problem that needs to be fixed for the feature to function as intended. core and removed more-information-needed Use this label when you are waiting on information from the issue creator labels May 8, 2019
@Tovli
Copy link
Author

Tovli commented May 8, 2019

Thanks. Maybe I'm misusing the authority parameter...
Will wait for you update

@runeabrahams1
Copy link

Hi, I'm getting the same error as @Tovli. I updated my code from preview.4 to the 1.0 release, then the error occurred.

Solved it by doing the change below. Not sure why i need to add authority again after adding it in the constructor of UserAgentApplication.

this.msalAgent = new UserAgentApplication({
  auth: {       
    clientId, // My client id
    authority // My Auth
  },
...
})

...
// Worked in 1.0.0-preview.4, but not 1.0.0
this.msalAgent.loginPopup().then(...)

// Works in 1.0.0
this.msalAgent.loginPopup({
  authority // My auth
}).then(...)

@pkanher617
Copy link
Contributor

Hi @Tovli and @runeabrahams1 thanks for your feedback.

Can you post the full stack trace of the error you are receiving? We can help better debug these issues that way. Thanks.

@sameerag
Copy link
Member

sameerag commented May 8, 2019

@Tovli and @runeabrahams1 I found one issue which will be a PR soon, in addition to this as @pkanher617 mentioned stack trace would help us get a test branch sooner to ensure we are fixing the same bug.

@sameerag
Copy link
Member

sameerag commented May 9, 2019

Can you guys please try #698 and let me know? The PR still needs Unit tests added, but I suspect this will fix your issue.

@Tovli
Copy link
Author

Tovli commented May 9, 2019

@sameerag thanks, I will test it later. In the meantime, here is my stackTrace:

Uncaught (in promise) ClientAuthError: Error: could not resolve endpoints. Please check network and try again.
    at ClientAuthError.AuthError [as constructor] (http://localhost:8080/app.js:25201:28)
    at new ClientAuthError (http://localhost:8080/app.js:25322:28)
    at Function../node_modules/msal/lib-es6/error/ClientAuthError.js.ClientAuthError.createEndpointResolutionError (http://localhost:8080/app.js:25332:16)
    at http://localhost:8080/app.js:22719:92```

@Tovli
Copy link
Author

Tovli commented May 9, 2019

@sameerag - As I am using npm to install msal in my app (vue spa). I cannot test this using the same way I would install the npm package you eventually publish (no name attribute in the package.json)
Please let me know if there is a way to install your branch as I would be happy to assist in testing.
Another option for you is to try it on the msal B2C sample

@LakeGH
Copy link

LakeGH commented May 9, 2019

Experiencing this issue as well, but only in Edge. In Chrome works as expected.

ClientAuthError: Error: could not resolve endpoints. Please check network and try again. Details: Error: Permission denied{"errorCode":"endpoints_resolution_error","errorMessage":"Error: could not resolve endpoints. Please check network and try again. Details: Error: Permission denied","name":"ClientAuthError"}
ClientAuthError: Error: could not resolve endpoints. Please check network and try again. Details: Error: Permission denied
   at AuthError (https://app.pd-local.com:3001/static/webApps/pptAddin/taskpaneClient.js?startTime=1557429993984:19057:9)
   at ClientAuthError (https://app.pd-local.com:3001/static/webApps/pptAddin/taskpaneClient.js?startTime=1557429993984:9931:9)
   at ClientAuthError.createEndpointResolutionError (https://app.pd-local.com:3001/static/webApps/pptAddin/taskpaneClient.js?startTime=1557429993984:9941:9)
   at Anonymous function (https://app.pd-local.com:3001/static/webApps/pptAddin/taskpaneClient.js?startTime=1557429993984:59058:17)
   at run (https://app.pd-local.com:3001/static/webApps/pptAddin/taskpaneClient.js?startTime=1557429993984:43655:13)
   at Anonymous function (https://app.pd-local.com:3001/static/webApps/pptAddin/taskpaneClient.js?startTime=1557429993984:43668:28)
   at flush (https://app.pd-local.com:3001/static/webApps/pptAddin/taskpaneClient.js?startTime=1557429993984:22180:9)

Configuration:

const appConfig = {
  auth: {
    clientId: config.msAuth.clientID,
    redirectUri: redirectUri,
    authority: "https://login.microsoftonline.com/common"
  },
  cache: {
    cacheLocation: "localStorage",
    storeAuthStateInCookie: true,
  },
};
const userAgentApplication = new Msal.UserAgentApplication(appConfig);

...
userAgentApplication
      .loginPopup({
        scopes: ["user.read"],
        prompt: "select_account",
        authority: "https://login.microsoftonline.com/common"
      })

We've tried with and without authority, but still get the same error on Edge. Chrome works in either case.

Tried using msal version 1.0.0 and 1.0.0-preview.5, same result.

@AE-MS
Copy link

AE-MS commented May 17, 2019

FWIW I believe I just ran into this issue the first time I tried to use the msal library. The symptoms+fix+error message seem to be the same. I debugging the issue and it does indeed seem to be fixed with #698 . Note that it affects both loginPopup and loginRedirect and #698 appears to fix both cases.

@sameerag
Copy link
Member

Great! Thanks, @AE-MS. I will optimize all our parameter checks tonight and finalize this PR. We want this included in the patch release we are planning next week.

@sameerag
Copy link
Member

#698 is now merged with dev.

@sameerag sameerag self-assigned this May 21, 2019
@sameerag
Copy link
Member

Closing this as the PR #698 got merged into dev now.

@Tovli
Copy link
Author

Tovli commented May 24, 2019 via email

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
b2c Related to Azure B2C library-specific issues bug A problem that needs to be fixed for the feature to function as intended.
Projects
None yet
Development

No branches or pull requests

6 participants