forked from Mirrors/oauth2
use variadics and fix build tags for App Engine files
This commit is contained in:
parent
f8fee03cb3
commit
040e271ca2
|
@ -2,8 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build appengine
|
// +build appengine,!appenginevm
|
||||||
// +build !appenginevm
|
|
||||||
|
|
||||||
package google
|
package google
|
||||||
|
|
||||||
|
@ -30,7 +29,7 @@ type AppEngineConfig struct {
|
||||||
|
|
||||||
// NewAppEngineConfig creates a new AppEngineConfig for the
|
// NewAppEngineConfig creates a new AppEngineConfig for the
|
||||||
// provided auth scopes.
|
// provided auth scopes.
|
||||||
func NewAppEngineConfig(context appengine.Context, scopes []string) *AppEngineConfig {
|
func NewAppEngineConfig(context appengine.Context, scopes ...string) *AppEngineConfig {
|
||||||
return &AppEngineConfig{
|
return &AppEngineConfig{
|
||||||
context: context,
|
context: context,
|
||||||
scopes: scopes,
|
scopes: scopes,
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build appenginevm
|
// +build appenginevm !appengine
|
||||||
|
|
||||||
package google
|
package google
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ type AppEngineConfig struct {
|
||||||
|
|
||||||
// NewAppEngineConfig creates a new AppEngineConfig for the
|
// NewAppEngineConfig creates a new AppEngineConfig for the
|
||||||
// provided auth scopes.
|
// provided auth scopes.
|
||||||
func NewAppEngineConfig(context appengine.Context, scopes []string) *AppEngineConfig {
|
func NewAppEngineConfig(context appengine.Context, scopes ...string) *AppEngineConfig {
|
||||||
return &AppEngineConfig{
|
return &AppEngineConfig{
|
||||||
context: context,
|
context: context,
|
||||||
scopes: scopes,
|
scopes: scopes,
|
||||||
|
|
|
@ -112,10 +112,8 @@ func Example_serviceAccounts() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func Example_appEngine() {
|
func Example_appEngine() {
|
||||||
context := appengine.NewContext(nil)
|
c := appengine.NewContext(nil)
|
||||||
config := google.NewAppEngineConfig(context, []string{
|
config := google.NewAppEngineConfig(c, "https://www.googleapis.com/auth/bigquery")
|
||||||
"https://www.googleapis.com/auth/bigquery",
|
|
||||||
})
|
|
||||||
// The following client will be authorized by the App Engine
|
// The following client will be authorized by the App Engine
|
||||||
// app's service account for the provided scopes.
|
// app's service account for the provided scopes.
|
||||||
client := http.Client{Transport: config.NewTransport()}
|
client := http.Client{Transport: config.NewTransport()}
|
||||||
|
|
Loading…
Reference in New Issue