mirror of
https://github.com/golang/oauth2.git
synced 2025-07-21 00:00:09 +08:00
Managed VM apps can use the net/http package directly, and can use the metadata server instead of the appengine package to get Service Account tokens. Change-Id: Ifa30eea446ffe4a9121ce3401900f4b73ddf07db Reviewed-on: https://go-review.googlesource.com/14125 Reviewed-by: Andrew Gerrand <adg@golang.org>
26 lines
534 B
Go
26 lines
534 B
Go
// Copyright 2014 The oauth2 Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
// +build appengine
|
|
|
|
// App Engine hooks.
|
|
|
|
package oauth2
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"golang.org/x/net/context"
|
|
"golang.org/x/oauth2/internal"
|
|
"google.golang.org/appengine/urlfetch"
|
|
)
|
|
|
|
func init() {
|
|
internal.RegisterContextClientFunc(contextClientAppEngine)
|
|
}
|
|
|
|
func contextClientAppEngine(ctx context.Context) (*http.Client, error) {
|
|
return urlfetch.Client(ctx), nil
|
|
}
|