aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/golang.org/x/oauth2/google/example_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/golang.org/x/oauth2/google/example_test.go')
-rw-r--r--vendor/golang.org/x/oauth2/google/example_test.go16
1 files changed, 14 insertions, 2 deletions
diff --git a/vendor/golang.org/x/oauth2/google/example_test.go b/vendor/golang.org/x/oauth2/google/example_test.go
index 92bc3b4..643f507 100644
--- a/vendor/golang.org/x/oauth2/google/example_test.go
+++ b/vendor/golang.org/x/oauth2/google/example_test.go
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build appenginevm appengine
-
package google_test
import (
@@ -12,6 +10,7 @@ import (
"log"
"net/http"
+ "golang.org/x/net/context"
"golang.org/x/oauth2"
"golang.org/x/oauth2/google"
"golang.org/x/oauth2/jwt"
@@ -148,3 +147,16 @@ func ExampleComputeTokenSource() {
}
client.Get("...")
}
+
+func ExampleCredentialsFromJSON() {
+ ctx := context.Background()
+ data, err := ioutil.ReadFile("/path/to/key-file.json")
+ if err != nil {
+ log.Fatal(err)
+ }
+ creds, err := google.CredentialsFromJSON(ctx, data, "https://www.googleapis.com/auth/bigquery")
+ if err != nil {
+ log.Fatal(err)
+ }
+ _ = creds // TODO: Use creds.
+}