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

State with =, & characters is incorrectly parsed from url fragment #913

Closed
3 tasks done
selaux opened this issue Mar 9, 2017 · 0 comments · Fixed by #916
Closed
3 tasks done

State with =, & characters is incorrectly parsed from url fragment #913

selaux opened this issue Mar 9, 2017 · 0 comments · Fixed by #916
Labels
bug This points to a verified bug in the code
Milestone

Comments

@selaux
Copy link
Contributor

selaux commented Mar 9, 2017

Whenever the state in the login callback url fragment includes an equal sign, it looses anything after the equal sign. The reason for that it that decodeUriComponent is called on the whole url fragment before parsing it, leading to encoded characters in state to make new query params instead of still belonging to hash.

  • Code snippet or sample project that reproduces the bug
const lock = new Lock('clientId', 'domain', {
    auth: {
        responseType: 'token',
        params: {
            // example 1
            state: '/some/path/to/redirect?q=firstparam&p=secondparam',
            // example 2
            state: 'asd&q=firstparam&p=secondparam'
        }
    }
});

lock.on('authenticated', function (result) {
    // will log /some/path/to/redirect?q= for example 1
    // will log asd for example 2
    console.log(result.state);
});
  • Lock version: 10.12.3
  • Browser & OS: Any
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This points to a verified bug in the code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants