Skip to content

Instantly share code, notes, and snippets.

@christopherhesse
Last active August 29, 2015 14:25
Show Gist options
  • Save christopherhesse/35965acdd1626b63e28d to your computer and use it in GitHub Desktop.
Save christopherhesse/35965acdd1626b63e28d to your computer and use it in GitHub Desktop.
import (
"golang.org/x/net/context"
"golang.org/x/oauth2"
"golang.org/x/oauth2/google"
"google.golang.org/appengine"
)
func CloudContext(c context.Context, scopes ...string) context.Context {
client := &http.Client{
Transport: &oauth2.Transport{
Source: google.AppEngineTokenSource(c, scopes...),
},
}
return cloud.WithContext(c, appengine.AppID(c), client)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment