stretchr/gomniauth — pull request #23 by jonathana (2014-10-02 23:14:49+00:00)
Title: Support for Google AppEngine urlfetch for OAuth2

To use http in Google AppEngine, you have to use urlfetch, not
the normal default http client or RoundTripper. So similar to
what one of the forks of goauth2 did, this adds the ability via
the now-added common/SetRoundTripper to pass in the specific
RoundTripper to use. If unset, the default net/http one will be
used. However, by calling this method, you can pass in your own
including one created via urlfetch. Here is sample code showing
it in use:

import (
"appengine"
"github.com/stretchr/gomniauth/common"
)

func SomeGolangFunc([...,] r *http.Request [,...]) {
c := appengine.NewContext(r)
t := new(urlfetch.Transport)
t.Context = c
common.SetRoundTripper(t)

// Do something interesting here
}

Note that common.SetRoundTripper may have to be called in the GAE
server before every request, versus trying to do it once because
of the appengine.Context being passed in. Pretty sure you cannot
pass in a nil *http.Request and re-use the context, so you can't
make the call during the GAE init() method.