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

Use content-type detection #11

Closed
GoogleCodeExporter opened this issue Dec 1, 2015 · 5 comments
Closed

Use content-type detection #11

GoogleCodeExporter opened this issue Dec 1, 2015 · 5 comments

Comments

@GoogleCodeExporter
Copy link

Trying to auth with GitHub. Since no `Accept` header can set in the request, 
GitHub will default to urlencoding for the answer. Simply supporting both, json 
and urlencoding, and switching over the `Content-Type` header is a viable 
solution.

I tested it with GitHub and Google. As far as I can tell it should also fix the 
"Facebook problem" without ludicrous solutions like hardcoding hostnames[1].

[1]: 
https://github.com/robfig/goauth2/commit/c649965654aa4d41f076735d2df236066a37d2b
9#L0R302

Original issue reported on code.google.com by su...@surmair.de on 5 Dec 2012 at 9:06

Attachments:

@GoogleCodeExporter
Copy link
Author

Seems like a reasonable approach. Can you please send a CL as per 
http://golang.org/doc/contribute.html ?

Original comment by a...@golang.org on 7 Dec 2012 at 3:40

  • Changed state: Accepted

@GoogleCodeExporter
Copy link
Author

Is there a problem with just setting the Accept: header for json?  I made a 
transport that adds it before the Exchange and it works now with GitHub.

Original comment by kev...@google.com on 7 Dec 2012 at 9:58

@GoogleCodeExporter
Copy link
Author

I found it easier to check the Content-Type then implementing a new Transport.
Also: How do you know that the provider actually supports json? This way, you 
definitely get an answer you just need to be able to decode it.

Original comment by su...@surmair.de on 7 Dec 2012 at 10:08

@GoogleCodeExporter
Copy link
Author

Issue 4 has been merged into this issue.

Original comment by a...@golang.org on 11 Dec 2012 at 11:18

@GoogleCodeExporter
Copy link
Author

This looks to have been fixed in 
https://code.google.com/p/goauth2/source/detail?r=f3b3146d6c91  I've manually 
verified that it works with both GitHub and Facebook.

Original comment by willnorris@google.com on 5 Jun 2013 at 4:27

  • Changed state: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant