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 inconsistent state assignment #1309

Merged
merged 1 commit into from
Mar 22, 2018
Merged

Fix inconsistent state assignment #1309

merged 1 commit into from
Mar 22, 2018

Conversation

luisrudge
Copy link
Contributor

@luisrudge luisrudge commented Mar 22, 2018

The correct way of sending the state parameter in the authentication request is

var options = {
  auth: {
    params: { state: 'foobar' }
  }
}

But, because of the bug I just fixed, this state, although being sent in the auth requests, wasn't being sent in the parseHash method, which caused the 'state doesn't match' error.
This gets the correct state without breaking anyone.

With this code, both version will work for parsing the hash with a specific state:

var options = {
  auth: {
    params: { state: 'foobar' }
  }
}
var options = {
  auth: {
    state: 'foobar'
  }
}

@luisrudge luisrudge added this to the v11.5.0 milestone Mar 22, 2018
Copy link
Contributor

@lbalmaceda lbalmaceda left a comment

Choose a reason for hiding this comment

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

Documentation should be clear over which state param is ultimately used. In the case of setting it on both places, the opts.params.state ends up being the one used.

@@ -34,11 +34,16 @@ class Auth0APIClient {
_telemetryInfo: opts._telemetryInfo || default_telemetry
});

var state = opts.state;
if (opts.params && opts.params.state) {
state = opts.params.state;
Copy link
Contributor

Choose a reason for hiding this comment

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

@luisrudge - if they have both then the former example in your description will override the latter. Is that expected? Is it consistently documented one way or the other?

Copy link
Contributor

@joshcanhelp joshcanhelp left a comment

Choose a reason for hiding this comment

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

Discussed the overriding and looks good as-is 👍

@luisrudge luisrudge merged commit b427f56 into master Mar 22, 2018
@luisrudge luisrudge deleted the fix-state-api branch March 22, 2018 20:10
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.

3 participants