forked from markbates/goth
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Experimental App Engine changes for Facebook
- Loading branch information
Showing
2 changed files
with
9 additions
and
3 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
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
2 comments
on commit 6e8230b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Used like this:
func init(){
fb := facebook.New("", "", "http://localhost:8080/auth/facebook/callback", )
fb.ContextProvider = getCurrentContext
fb.ClientProvider = getHttpClient
goth.UseProviders(
fb,
)
}
var httpClient *http.Client
var currentContext context.Context
func getHttpClient() *http.Client {
return urlfetch.Client(getCurrentContext())
}
func getCurrentContext() context.Context {
return currentContext
}
// ..
func rootHandler(res http.ResponseWriter, req *http.Request) {
c := appengine.NewContext(req)
// I *think* the context changes for each request so we have to constantly update it =[
currentContext = c
//..
}
func otherHandler(res http.ResponseWriter, req *http.Request) {
c := appengine.NewContext(req)
currentContext = c
//..
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be much nicer if we could supply http.Request to the ContextProvider.
fix