I post JSON to an app I registered at Google App Engine but I am baffled by the authentication process in my Go code to get it working in appengine:
func init() {
http.HandleFunc("/post", handler)
}
func handler(w http.ResponseWriter, r *http.Request) {
app := appengine.NewContext(r)
client := &http.Client{
Transport: &oauth2.Transport{
Source: google.AppEngineTokenSource(app, "https://www.googleapis.com/auth/bigquery"),
Base: &urlfetch.Transport{
Context: app,
},
},
}
log.Print(client)
}
In following the docs, I have reduced my problem to the code above which consistently gives me the following error:
2015/01/28 09:05:32 appengine: NewContext passed an unknown http.Request
I'd love some pointers as to how I can provide appengine with a "known" http.Request because ultimately I am trying to get to the storage api which also requires a valid context.