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 SSO query params #950

Merged
merged 2 commits into from
Jun 20, 2023

Conversation

psrpinto
Copy link
Contributor

@psrpinto psrpinto commented Dec 13, 2022

Currently, SSO is not functional when hydrogen is loaded on a page with a URL containing query parameters (e.g. http://example.com?foo=bar&bar=baz), as the query parameters get stripped.

The query parameters are removed in two places:

  1. Query parameters are stripped from the redirectUrl parameter, so the resulting URL is https://example.com/_matrix/client/r0/login/sso/redirect?redirectUrl=http://example.com.
  2. Query parameters are stripped upon returning to the page once SSO is done.

In #911 we made it so that SSO callback URLs containing query parameters are correctly passed to the homeserver. However, we weren't yet actually passing the query parameters, as described above. This PR fixes that, so that:

  1. The redirectUrl parameter now contains query parameters, e.g. https://example.com/_matrix/client/r0/login/sso/redirect?redirectUrl=http%3A%2F%2Fexample.com%3Afoo%3Dbar%26bar%3Dbaz
  2. Only the loginToken query parameter is stripped upon returning to the page after SSO.

Copy link
Member

@MidhunSureshR MidhunSureshR left a comment

Choose a reason for hiding this comment

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

LGTM, thanks 🔥

@MidhunSureshR MidhunSureshR merged commit b42e497 into element-hq:master Jun 20, 2023
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.

2 participants