Skip to content

Instantly share code, notes, and snippets.

@christopherhesse
Last active August 29, 2015 14:25
Show Gist options
  • Save christopherhesse/47f2a074daaef5fa4bf6 to your computer and use it in GitHub Desktop.
Save christopherhesse/47f2a074daaef5fa4bf6 to your computer and use it in GitHub Desktop.
import (
"code.google.com/p/goauth2/appengine/serviceaccount"
"golang.org/x/net/context"
"appengine"
)
// oauth2 module requires a context.Context so use goauth2 for now
func CloudContext(c appengine.Context, scopes ...string) context.Context {
client, _ := serviceaccount.NewClient(c, scopes...)
return cloud.WithContext(context.Background(), appengine.AppID(c), client)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment