1// Copyright 2018 The Go Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style 3// license that can be found in the LICENSE file. 4 5// Package google provides support for making OAuth2 authorized and authenticated 6// HTTP requests to Google APIs. It supports the Web server flow, client-side 7// credentials, service accounts, Google Compute Engine service accounts, and Google 8// App Engine service accounts. 9// 10// A brief overview of the package follows. For more information, please read 11// https://developers.google.com/accounts/docs/OAuth2 12// and 13// https://developers.google.com/accounts/docs/application-default-credentials. 14// 15// OAuth2 Configs 16// 17// Two functions in this package return golang.org/x/oauth2.Config values from Google credential 18// data. Google supports two JSON formats for OAuth2 credentials: one is handled by ConfigFromJSON, 19// the other by JWTConfigFromJSON. The returned Config can be used to obtain a TokenSource or 20// create an http.Client. 21// 22// 23// Credentials 24// 25// The Credentials type represents Google credentials, including Application Default 26// Credentials. 27// 28// Use FindDefaultCredentials to obtain Application Default Credentials. 29// FindDefaultCredentials looks in some well-known places for a credentials file, and 30// will call AppEngineTokenSource or ComputeTokenSource as needed. 31// 32// DefaultClient and DefaultTokenSource are convenience methods. They first call FindDefaultCredentials, 33// then use the credentials to construct an http.Client or an oauth2.TokenSource. 34// 35// Use CredentialsFromJSON to obtain credentials from either of the two JSON formats 36// described in OAuth2 Configs, above. The TokenSource in the returned value is the 37// same as the one obtained from the oauth2.Config returned from ConfigFromJSON or 38// JWTConfigFromJSON, but the Credentials may contain additional information 39// that is useful is some circumstances. 40package google // import "golang.org/x/oauth2/google" 41