-
Notifications
You must be signed in to change notification settings - Fork 117
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
app engine support #60
base: master
Are you sure you want to change the base?
Conversation
App Engine requires use of context-specific HTTP clients. Outbound HTTP requests simply don't work unless there's a way to provide the current request context to the outgoing request. Because a *Consumer might outlast multiple requests, we need a way to thread the request context through and then optionally create an *http.Client based on it. Unfortunately, this requires adding a bunch of new arguments. My preference would be to require contexts for all callsites, but I realize that breaks backwards compatibility, so I've added new methods.
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?
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?
Hi, thanks for the patch. I'm really sorry it took me so long to get to it! Admittedly, it's been quite some time since I've used AppEngine on a regular basis, so things could have changed. However, in the past it was possible to use this library inside of AppEngine by supplying your own HttpClient constructed using an AppEngine context. Unfortunately, my original use case got migrated to OAuth 2.0, so I can't verify that it still works. However, I think this code is almost identical to the technique I used: Eliding a few details it looks like: // r is a *http.Request Will this existing interface meet your needs? |
App Engine requires use of context-specific HTTP clients. Outbound
HTTP requests simply don't work unless there's a way to provide
the current request context to the outgoing request.
Because a *Consumer might outlast multiple requests, we need a way
to thread the request context through and then optionally create
an *http.Client based on it. Unfortunately, this requires adding
a bunch of new arguments.
My preference would be to require contexts for all callsites, but
I realize that breaks backwards compatibility, so I've added new
methods.