• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

amazon/H06-Nov-2018-

bitbucket/H06-Nov-2018-

cern/H06-Nov-2018-

clientcredentials/H06-Nov-2018-

facebook/H06-Nov-2018-

fitbit/H06-Nov-2018-

foursquare/H06-Nov-2018-

github/H06-Nov-2018-

gitlab/H06-Nov-2018-

google/H06-Nov-2018-

heroku/H06-Nov-2018-

hipchat/H06-Nov-2018-

instagram/H06-Nov-2018-

internal/H06-Nov-2018-

jira/H06-Nov-2018-

jws/H06-Nov-2018-

jwt/H06-Nov-2018-

kakao/H06-Nov-2018-

linkedin/H06-Nov-2018-

mailchimp/H06-Nov-2018-

mailru/H06-Nov-2018-

mediamath/H06-Nov-2018-

microsoft/H06-Nov-2018-

nokiahealth/H06-Nov-2018-

odnoklassniki/H06-Nov-2018-

paypal/H06-Nov-2018-

slack/H06-Nov-2018-

spotify/H06-Nov-2018-

stackoverflow/H06-Nov-2018-

twitch/H06-Nov-2018-

uber/H06-Nov-2018-

vk/H06-Nov-2018-

yahoo/H06-Nov-2018-

yandex/H06-Nov-2018-

.travis.ymlH A D06-Nov-2018262

AUTHORSH A D06-Nov-2018173

CONTRIBUTING.mdH A D06-Nov-2018924

CONTRIBUTORSH A D06-Nov-2018170

LICENSEH A D06-Nov-20181.4 KiB

README.mdH A D06-Nov-20182.8 KiB

example_test.goH A D06-Nov-20182.4 KiB

oauth2.goH A D06-Nov-201811.6 KiB

oauth2_test.goH A D06-Nov-201818.2 KiB

token.goH A D06-Nov-20184.8 KiB

token_test.goH A D06-Nov-20182 KiB

transport.goH A D06-Nov-20183.2 KiB

transport_test.goH A D06-Nov-20184 KiB

README.md

1# OAuth2 for Go
2
3[![Build Status](https://travis-ci.org/golang/oauth2.svg?branch=master)](https://travis-ci.org/golang/oauth2)
4[![GoDoc](https://godoc.org/golang.org/x/oauth2?status.svg)](https://godoc.org/golang.org/x/oauth2)
5
6oauth2 package contains a client implementation for OAuth 2.0 spec.
7
8## Installation
9
10~~~~
11go get golang.org/x/oauth2
12~~~~
13
14Or you can manually git clone the repository to
15`$(go env GOPATH)/src/golang.org/x/oauth2`.
16
17See godoc for further documentation and examples.
18
19* [godoc.org/golang.org/x/oauth2](http://godoc.org/golang.org/x/oauth2)
20* [godoc.org/golang.org/x/oauth2/google](http://godoc.org/golang.org/x/oauth2/google)
21
22
23## App Engine
24
25In change 96e89be (March 2015), we removed the `oauth2.Context2` type in favor
26of the [`context.Context`](https://golang.org/x/net/context#Context) type from
27the `golang.org/x/net/context` package. Later replaced by the standard `context` package
28of the [`context.Context`](https://golang.org/pkg/context#Context) type.
29
30
31This means it's no longer possible to use the "Classic App Engine"
32`appengine.Context` type with the `oauth2` package. (You're using
33Classic App Engine if you import the package `"appengine"`.)
34
35To work around this, you may use the new `"google.golang.org/appengine"`
36package. This package has almost the same API as the `"appengine"` package,
37but it can be fetched with `go get` and used on "Managed VMs" and well as
38Classic App Engine.
39
40See the [new `appengine` package's readme](https://github.com/golang/appengine#updating-a-go-app-engine-app)
41for information on updating your app.
42
43If you don't want to update your entire app to use the new App Engine packages,
44you may use both sets of packages in parallel, using only the new packages
45with the `oauth2` package.
46
47```go
48import (
49	"context"
50	"golang.org/x/oauth2"
51	"golang.org/x/oauth2/google"
52	newappengine "google.golang.org/appengine"
53	newurlfetch "google.golang.org/appengine/urlfetch"
54
55	"appengine"
56)
57
58func handler(w http.ResponseWriter, r *http.Request) {
59	var c appengine.Context = appengine.NewContext(r)
60	c.Infof("Logging a message with the old package")
61
62	var ctx context.Context = newappengine.NewContext(r)
63	client := &http.Client{
64		Transport: &oauth2.Transport{
65			Source: google.AppEngineTokenSource(ctx, "scope"),
66			Base:   &newurlfetch.Transport{Context: ctx},
67		},
68	}
69	client.Get("...")
70}
71```
72
73## Policy for new packages
74
75We no longer accept new provider-specific packages in this repo. For
76defining provider endpoints and provider-specific OAuth2 behavior, we
77encourage you to create packages elsewhere. We'll keep the existing
78packages for compatibility.
79
80## Report Issues / Send Patches
81
82This repository uses Gerrit for code changes. To learn how to submit changes to
83this repository, see https://golang.org/doc/contribute.html.
84
85The main issue tracker for the oauth2 repository is located at
86https://github.com/golang/oauth2/issues.
87