Switch branches/tags
Nothing to show
Clone or download
jrmycanady and bradfitz nokiehealth: add endpoint for Nokia Health Mate
Change-Id: I4fdc7be10d1e10c188889aa149fd5019a7c062bd
GitHub-Last-Rev: 6fbdac8
GitHub-Pull-Request: golang/oauth2#315
Reviewed-on: https://go-review.googlesource.com/130477
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Latest commit d2e6202 Aug 21, 2018
Permalink
Failed to load latest commit information.
amazon amazon: add amazon endpoints Apr 12, 2017
bitbucket bitbucket: add end points Sep 17, 2015
cern cern: add CERN OAuth endpoint May 29, 2018
clientcredentials internal: inline CondVal function Jan 2, 2018
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
gitlab gitlab: Use correct endpoint URLs May 21, 2018
google google: add CredentialsFromJSON Mar 12, 2018
heroku heroku: Add Heroku's endpoints Aug 23, 2016
hipchat hipchat: Generate Config for Connect integrations Apr 28, 2016
instagram instagram: add Instagram endpoints Jul 24, 2018
internal nokiehealth: add endpoint for Nokia Health Mate Aug 21, 2018
jira jira: fix bug when upper-casing scopes May 3, 2018
jws oauth2, jws, internal: more style fixes for bad test messages Aug 26, 2016
jwt jwt: use RetrieveError for invalid status code errors Dec 26, 2017
kakao kakao: Add new endpoint of Kakao May 28, 2018
linkedin linkedin: Update to new endpoint May 23, 2018
mailchimp mailchimp: add MailChimp provider Feb 28, 2018
mailru mailru: add Mail.Ru OAuth2 endpoint Dec 15, 2017
mediamath mediamath: add MediaMath endpoints Aug 17, 2016
microsoft microsoft: improve azure active directory endpoint Dec 13, 2017
nokiahealth nokiehealth: add endpoint for Nokia Health Mate Aug 21, 2018
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
spotify spotify: add Spotify endpoints Jan 4, 2018
stackoverflow stackoverflow: add stackoverflow oauth2 endpoints. Jun 20, 2018
twitch twitch: update to new endpoint May 21, 2018
uber uber: Add Uber API endpoints Aug 10, 2016
vk all: change copyright to 'Go Authors' Oct 22, 2015
yahoo yahoo: add Yahoo OAuth2 endpoint Dec 15, 2017
yandex oauth2: add Yandex endpoint Feb 27, 2017
.travis.yml travis: always build against tip May 20, 2016
AUTHORS Reverting the license back to the original. May 17, 2014
CONTRIBUTING.md CONTRIBUTING.md: remove note about not accepting Pull Requests Mar 14, 2018
CONTRIBUTORS Reverting the license back to the original. May 17, 2014
LICENSE LICENSE: attribute to the Go authors Aug 2, 2017
README.md README: add links for contributions Jul 19, 2017
example_test.go oauth2: improve the custom HTTP client example Sep 1, 2017
oauth2.go oauth2: Add support for custom params in Exchange Jun 19, 2018
oauth2_test.go oauth2: Add support for custom params in Exchange Jun 19, 2018
token.go oauth2: add error type for unsuccessful token endpoint status Dec 19, 2017
token_test.go all: change copyright to 'Go Authors' Oct 22, 2015
transport.go oauth2: remove misleading Transport.RoundTrip comment May 29, 2018
transport_test.go oauth2: close request body if errors occur before base RoundTripper i… May 29, 2018

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

Or you can manually git clone the repository to $(go env GOPATH)/src/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 it's 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("...")
}

Report Issues / Send Patches

This repository uses Gerrit for code changes. To learn how to submit changes to this repository, see https://golang.org/doc/contribute.html.

The main issue tracker for the oauth2 repository is located at https://github.com/golang/oauth2/issues.