forked from markbates/goth
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
App Engine unfortunately can't make outbound requests without using the appengine urlfetch library and a request-specific context. I don't see a way around this other than to change the signature of the Provider and Session interfaces. This really has a huge amount of downsides obviously, but before I go and fix stuff for providers besides Facebook, G+, and Twitter (Twitter support requires mrjones/oauth#60 to get merged), I figured I'd open a pull request and discuss the tradeoffs. Unfortunately I think we need to do something like this to support App Engine. Perhaps this is an opportunity to version goth using gopkg.in or something?
- Loading branch information
Showing
10 changed files
with
191 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// +build !appengine | ||
|
||
package goth | ||
|
||
import ( | ||
"net/http" | ||
|
||
"golang.org/x/net/context" | ||
) | ||
|
||
// Provider implementations should use this method for making outbound HTTP | ||
// requests. | ||
var HTTPClient = func(ctx context.Context) (*http.Client, error) { | ||
return http.DefaultClient, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// +build appengine | ||
|
||
package goth | ||
|
||
import ( | ||
"net/http" | ||
|
||
"golang.org/x/net/context" | ||
"google.golang.org/appengine/urlfetch" | ||
) | ||
|
||
// Provider implementations should use this method for making outbound HTTP | ||
// requests. | ||
var HTTPClient = func(ctx context.Context) (*http.Client, error) { | ||
return urlfetch.Client(ctx), nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.