Go
Latest commit 314dd2c Dec 14, 2016 @tcolgate tcolgate committed with rakyll golang.org/x/oauth2/jwt: Set kid to KeyID of private key
Set the KeyID hint in the token header. This allows remote servers to
identify the key used to sign the message.

Fixes #18307

Change-Id: Ib95398079833aad6b390650b465d7b09b5f53fda
Reviewed-on: https://go-review.googlesource.com/34320
Reviewed-by: Jaana Burcu Dogan <jbd@google.com>
Permalink
Failed to load latest commit information.
bitbucket bitbucket: add end points Sep 17, 2015
clientcredentials clientcredentials: inline singly-used functions Nov 3, 2016
facebook all: change copyright to 'Go Authors' Oct 22, 2015
fitbit fitbit: add Fitbit API endpoints Mar 23, 2016
foursquare oauth2: add Foursquare's Endpoint Oct 25, 2016
github all: change copyright to 'Go Authors' Oct 22, 2015
google google: prefer os.Getenv("HOME") over os/user.Current() so as to avoi… Dec 13, 2016
heroku heroku: Add Heroku's endpoints Aug 23, 2016
hipchat hipchat: Generate Config for Connect integrations Apr 28, 2016
internal token: added new broken auth header providers Dec 9, 2016
jws oauth2, jws, internal: more style fixes for bad test messages Aug 26, 2016
jwt golang.org/x/oauth2/jwt: Set kid to KeyID of private key Dec 19, 2016
linkedin all: change copyright to 'Go Authors' Oct 22, 2015
mediamath mediamath: add MediaMath endpoints Aug 17, 2016
microsoft microsoft: add windows live endpoints Jan 19, 2016
odnoklassniki all: change copyright to 'Go Authors' Oct 22, 2015
paypal all: change copyright to 'Go Authors' Oct 22, 2015
slack slack: new package with Slack's endpoints Feb 17, 2016
uber uber: Add Uber API endpoints Aug 10, 2016
vk all: change copyright to 'Go Authors' Oct 22, 2015
.travis.yml travis: always build against tip May 20, 2016
AUTHORS Reverting the license back to the original. May 17, 2014
CONTRIBUTING.md doc: fix the issues link Mar 25, 2015
CONTRIBUTORS Reverting the license back to the original. May 17, 2014
LICENSE Reverting the license back to the original. May 17, 2014
README.md doc: add godoc button Aug 26, 2016
client_appengine.go all: change copyright to 'Go Authors' Oct 22, 2015
example_test.go all: deprecate NoContext Aug 24, 2016
oauth2.go all: deprecate NoContext Aug 24, 2016
oauth2_test.go oauth2: fix brittle test Oct 7, 2016
token.go all: change copyright to 'Go Authors' Oct 22, 2015
token_test.go all: change copyright to 'Go Authors' Oct 22, 2015
transport.go all: change copyright to 'Go Authors' Oct 22, 2015
transport_test.go oauth2, jws, internal: more style fixes for bad test messages Aug 26, 2016

README.md

OAuth2 for Go

Build Status GoDoc

oauth2 package contains a client implementation for OAuth 2.0 spec.

Installation

go get golang.org/x/oauth2

See godoc for further documentation and examples.

App Engine

In change 96e89be (March 2015) we removed the oauth2.Context2 type in favor of the context.Context type from the golang.org/x/net/context package

This means its no longer possible to use the "Classic App Engine" appengine.Context type with the oauth2 package. (You're using Classic App Engine if you import the package "appengine".)

To work around this, you may use the new "google.golang.org/appengine" package. This package has almost the same API as the "appengine" package, but it can be fetched with go get and used on "Managed VMs" and well as Classic App Engine.

See the new appengine package's readme for information on updating your app.

If you don't want to update your entire app to use the new App Engine packages, you may use both sets of packages in parallel, using only the new packages with the oauth2 package.

import (
    "golang.org/x/net/context"
    "golang.org/x/oauth2"
    "golang.org/x/oauth2/google"
    newappengine "google.golang.org/appengine"
    newurlfetch "google.golang.org/appengine/urlfetch"

    "appengine"
)

func handler(w http.ResponseWriter, r *http.Request) {
    var c appengine.Context = appengine.NewContext(r)
    c.Infof("Logging a message with the old package")

    var ctx context.Context = newappengine.NewContext(r)
    client := &http.Client{
        Transport: &oauth2.Transport{
            Source: google.AppEngineTokenSource(ctx, "scope"),
            Base:   &newurlfetch.Transport{Context: ctx},
        },
    }
    client.Get("...")
}