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

callback_url definition #28

Open
blarralde opened this issue Jan 11, 2013 · 10 comments
Open

callback_url definition #28

blarralde opened this issue Jan 11, 2013 · 10 comments

Comments

@blarralde
Copy link

Hello

Is there any reason why callback_url is overriden line 37?
It's losing query_string from its original definition, which I find very useful...

Cheers
Ben

tmilewski added a commit that referenced this issue Sep 4, 2013
Overridden method discarded the query_string
@tmilewski
Copy link
Member

I couldn't find a reason as to why this would be the case. I would like @mbleigh to weigh in before merging this into master.

Per RFC3986:

The endpoint URI MAY include an "application/x-www-form-urlencoded" formatted (per Appendix B) query component ([RFC3986] Section 3.4), which MUST be retained when adding additional query parameters.

http://tools.ietf.org/html/rfc6749#section-3.1.2

@jeroenj
Copy link

jeroenj commented Feb 24, 2014

Is there any news on this? It took me quite some time debugging why the callback url would lose the querystring.

@h0tw1r3
Copy link

h0tw1r3 commented Oct 1, 2014

Patch breaks google oauth2, but twitter and facebook work fine.

stereobooster added a commit to stereobooster/omniauth-spotify that referenced this issue Mar 16, 2015
masterkain added a commit to icoretech/omniauth-spotify that referenced this issue Mar 16, 2015
stereobooster added a commit to stereobooster/omniauth-beats that referenced this issue Mar 16, 2015
@stereobooster
Copy link

Breaks Spotify and Beats (which do not accept callback urls with get params).

You can use request.env['omniauth.params'] in callback controller

@chamnap
Copy link

chamnap commented Mar 25, 2015

@stereobooster, request.env['omniauth.params'] is nil inside my callback controller.

masterkain added a commit to icoretech/omniauth-spotify that referenced this issue Apr 21, 2015
sferik added a commit that referenced this issue Oct 21, 2015
Don't override callback_url Attempt to correct #28
@NobodysNightmare
Copy link

A little silent in here...

I think the override was removed in #70.

However, now the callback_url contains the code and state query parameters for me:

>>  callback_url
=> "http://localhost:3005/auth/XXX/callback?code=63e874156af1c6e9c056c34f5225ac7fa58f4cb0ba1ce19f12674fe51f20739c&state=864417e69b314d78dd33201169c7ca58dad54070ea6f80f1"

At least the code parameter was provided by the AS in response to the Authorization Request. However, a spec compliant AS must compare the redirect_uri it received in the Authorization Request with the one in the Access Token Request.

Since the former request could not possibly contain the code parameter, this parameter (and probably also state) should not be transmitted in the latter request.

tl; dr: By transmitting the code parameter in the Access Token Request, the AS verification of the redirect_uri fails.

I don't quite know why this is no issue for many more people...

@caseyprovost
Copy link

+1 sameissue here

knu added a commit to knu/omniauth-oauth2 that referenced this issue Nov 14, 2016
I think this is a better fix for omniauth#28, and saves many OAuth2 strategies
broken by omniauth#70.
knu added a commit to knu/omniauth-oauth2 that referenced this issue Nov 15, 2016
I think this is a better fix for omniauth#28, and saves many OAuth2 strategies
broken by omniauth#70.
knu added a commit to knu/omniauth-oauth2 that referenced this issue Nov 15, 2016
I think this is a better fix for omniauth#28, and saves many OAuth2 strategies
broken by omniauth#70.
@jmanian
Copy link

jmanian commented Aug 24, 2022

I had the same issue @NobodysNightmare mentioned above — the removal of the callback_url definition in #70 broke my custom strategies, because the redirect_uri during the callback phase does not match the original one.

I had to add this to all my custom strategies to get them working again.

def callback_url
  full_host + callback_path
end

I also use omnituah-google-oauth2, which continued to work after #70, and I was wondering why it didn't have the same problem with redirect_url mismatch, and it's because it has basically the same override.

@sirwolfgang
Copy link

I just ran into this issue with trying to implement Airtable; Where they were rejecting the redirect_uri if it had the additional QSP.

While it seems like the spec is well defined, it does seem common enough of an implementation detail that it might be wise to uplevel this to an option that may be configured depending on how the server is behaving.

@WillPowelson-at
Copy link

WillPowelson-at commented Jan 3, 2023

Chiming in from Airtable, our reading of RFC3986:

The endpoint URI MAY include an "application/x-www-form-urlencoded" formatted (per Appendix B) query component ([RFC3986] Section 3.4), which MUST be retained when adding additional query parameters.

http://tools.ietf.org/html/rfc6749#section-3.1.2

was that query parameters included in redirect URI stored in authorization server's database must be preserved. e.g. if you've registered the URI https://www.mysite.com/oauth-redirect?myParam=staticArg then myParam=staticArg must be preserved when we redirect the user, note that we should allow additional or dynamic query parameters during authorization (we may relax this in the future but I can't offer any timelines, sorry!)

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

No branches or pull requests