summaryrefslogtreecommitdiff
path: root/example_test.go
diff options
context:
space:
mode:
authorBurcu Dogan <jbd@google.com>2014-11-24 17:07:50 -0800
committerBurcu Dogan <jbd@google.com>2014-11-25 14:36:49 -0800
commitb8463885646621ad3debe22376c60031788d9f5e (patch)
tree8c572526823be65e998883ae1a858b89e5f7237e /example_test.go
parentc048af9da2ff4db86f1ad989c73c6ec7a62c57a4 (diff)
downloadgolang-x-oauth2-b8463885646621ad3debe22376c60031788d9f5e.tar.gz
oauth2: Removing the inconsistent and duplicate features, better naming
- Removed Flow, flow is a nothing but options. - Renamed Cacher to Storer. - Removed the setter from the Transport. Store should do the initial set. Getter is not removed, because extra fields are available through Transport.Token.Extra(). It's not pleasant to implement a custom Storer implementation to read such values. oauth2: Remove VMs from the AppEngine example title
Diffstat (limited to 'example_test.go')
-rw-r--r--example_test.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/example_test.go b/example_test.go
index 52a3587..63ba707 100644
--- a/example_test.go
+++ b/example_test.go
@@ -18,7 +18,7 @@ import (
func TestA(t *testing.T) {}
func Example_regular() {
- f, err := oauth2.New(
+ opts, err := oauth2.New(
oauth2.Client("YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET"),
oauth2.RedirectURL("YOUR_REDIRECT_URL"),
oauth2.Scope("SCOPE1", "SCOPE2"),
@@ -33,7 +33,7 @@ func Example_regular() {
// Redirect user to consent page to ask for permission
// for the scopes specified above.
- url := f.AuthCodeURL("state", "online", "auto")
+ url := opts.AuthCodeURL("state", "online", "auto")
fmt.Printf("Visit the URL for the auth dialog: %v", url)
// Use the authorization code that is pushed to the redirect URL.
@@ -44,7 +44,7 @@ func Example_regular() {
if _, err = fmt.Scan(&code); err != nil {
log.Fatal(err)
}
- t, err := f.NewTransportFromCode(code)
+ t, err := opts.NewTransportFromCode(code)
if err != nil {
log.Fatal(err)
}
@@ -56,7 +56,7 @@ func Example_regular() {
}
func Example_jWT() {
- f, err := oauth2.New(
+ opts, err := oauth2.New(
// The contents of your RSA private key or your PEM file
// that contains a private key.
// If you have a p12 file instead, you
@@ -82,6 +82,6 @@ func Example_jWT() {
// Initiate an http.Client, the following GET request will be
// authorized and authenticated on the behalf of user@example.com.
- client := http.Client{Transport: f.NewTransport()}
+ client := http.Client{Transport: opts.NewTransport()}
client.Get("...")
}