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

Fix cases where request is undefined for user passed 'state' checks #698

Merged
merged 6 commits into from May 20, 2019

Conversation

sameerag
Copy link
Member

@sameerag sameerag commented May 8, 2019

Fix cases where request is undefined for user passed 'state' checks before passing it ServerRequestParameters

@sameerag sameerag self-assigned this May 15, 2019
Copy link
Contributor

@pkanher617 pkanher617 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make the if condition either "if (request)" or "if (request && request.state)", but choose one or the other and don't use both in the file.

@@ -371,6 +371,12 @@ export class UserAgentApplication {
// Track login in progress
this.loginInProgress = true;

// request can be optional for login calls, hence check for the same
let reqState: string;
if (request) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the function parameter be declared as
request?: AuthenticationParameters
instead to indicate that it is valid for it to be undefined?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AE-MS Thanks for reviewing! It is true that making the request parameter optional would allow us to pass it as undefined, which is what we have exposed in the loginRedirect function. However, that doesn't solve the issue of trying to retrieve state from a possibly null request object, which is what the code here does. We will try to find a more elegant solution for this when we perform some refactoring in the future.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AE-MS Updated the login helper functions too to have optional parameters, to clear any confusion extending what @pkanher617 mentioned - "request" is optional only for login() functions but not for acquireToken() calls.

@DarylThayil
Copy link
Contributor

lgtm

@sameerag sameerag merged commit a4c26d2 into dev May 20, 2019
@sameerag sameerag deleted the fix_state_in_loginCalls branch May 21, 2019 03:54
@mmarshad
Copy link

I'm having the same issue today with following error
Error in logging in: ClientAuthError: endpoints_resolution_error: Error: could not resolve endpoints. Please check network and try again. Detail: ClientConfigurationError: untrusted_authority: The provided authority is not a trusted authority. Please include this authority in the knownAuthorities config parameter.
at t [as constructor] (https://xxxx/static/js/2.8c752529.chunk.js:2:136326)
at new t (https://xxxxx/static/js/2.8c752529.chunk.js:2:103927)
at Function.t.createEndpointDiscoveryIncompleteError (https://xxxxx/static/js/2.8c752529.chunk.js:2:104619)
at Function. (https://xxxxx/static/js/2.8c752529.chunk.js:2:1872752)
at https://xxxxx/static/js/2.8c752529.chunk.js:2:62868
at Object.throw (https://xxxx/static/js/2.8c752529.chunk.js:2:62973)
at s (https://etdcorestrdevne.z16.web.core.windows.net/static/js/2.8c752529.chunk.js:2:61762)

It was working until yesterday but today when we deploy the build to server, starting getting above error. from localhost its still working fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants