Navigation Menu

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

Pass params submitted to launch-uri to authorization-uri #42

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

sbauch
Copy link

@sbauch sbauch commented Feb 10, 2021

Some OAuth providers support extra query params that aren't appropriate for hardcoding. One example is Google OAuth, which accepts an hd param to the authorization URL that can restrict logins to users with the provided email domain.

This allows a developer to submit a request to the launch-uri with parameters. These parameters will now be passed along to the authorization URI as the user is sent to the OAuth provider to authenticate.

Also adds a test for this functionality.

#41

I'm definitely out of my element here! I ran a linter and it didnt catch anything but I'm not sure I handled indentation correctly.

Some OAuth providers support extra query params that aren't appropriate for hardcoding. One example is Google OAuth, which accepts an `hd` param to the authorization URL that can restrict logins to users with the provided email domain.

This commit allows a developer to submit a request to the launch-uri with parameters. These parameters will now be passed along to the authorization URI as the user is sent to the OAuth provider to authenticate.

Also adds a test for this functionality.

weavejester#41
@sbauch
Copy link
Author

sbauch commented Feb 17, 2021

would love to get some 👀 on this if you have some bandwidth! we have some folks starting to use our fork and I'm not terribly confident this is up to snuff 🙈

@weavejester
Copy link
Owner

Rather than using wrap-params, instead we should pull out the query-string and append it to the URL being generated.

@@ -19,6 +19,7 @@
(defn- authorize-uri [profile request state]
(str (:authorize-uri profile)
(if (.contains ^String (:authorize-uri profile) "?") "&" "?")
(request :query-string)
Copy link
Author

Choose a reason for hiding this comment

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

a little unsure how to handle cases where there is no query string, though the tests are green so perhaps this is enough?

Copy link
Owner

Choose a reason for hiding this comment

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

I'd suggest changing this to: (:query-string request). In general that's more robust.

@sbauch
Copy link
Author

sbauch commented Feb 24, 2021

I realized that my previous approach wasn't including an & between the params from the querystring and the other params we're adding.

I improved the test and patched the issue, but I'm less and less confident here and would appreciate some help getting it over the finish line from someone with a bit more clojure experience 🙏

@sbauch
Copy link
Author

sbauch commented Apr 7, 2021

@weavejester hate to bother but could you take another look here? 🙏

@weavejester
Copy link
Owner

This looks fine. Can you squash down your commits and make sure the commit message is okay?

@weavejester
Copy link
Owner

Just chasing this up: do you have time to squash the commits and make the commit message:

Relay params from launch URI to authorization URI

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

2 participants