google

package
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 18, 2015 License: BSD-3-Clause, Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package google provides support for making OAuth2 authorized and authenticated HTTP requests to Google APIs. It supports Web server, client-side, service accounts, Google Compute Engine service accounts, and Google App Engine service accounts authorization and authentications flows:

For more information, please read https://developers.google.com/accounts/docs/OAuth2.

Example (ServiceAccount)
Output:

Example (WebServer)
Output:

Index

Examples

Constants

View Source
const JWTTokenURL = "https://accounts.google.com/o/oauth2/token"

JWTTokenURL is Google's OAuth 2.0 token URL to use with the JWT flow.

Variables

View Source
var Endpoint = oauth2.Endpoint{
	AuthURL:  "https://accounts.google.com/o/oauth2/auth",
	TokenURL: "https://accounts.google.com/o/oauth2/token",
}

Endpoint is Google's OAuth 2.0 endpoint.

Functions

func AppEngineTokenSource

func AppEngineTokenSource(ctx appengine.Context, scope ...string) oauth2.TokenSource

AppEngineTokenSource returns a token source that fetches tokens issued to the current App Engine application's service account. If you are implementing a 3-legged OAuth 2.0 flow on App Engine that involves user accounts, see oauth2.Config instead.

You are required to provide a valid appengine.Context as context.

Example
Output:

func ComputeTokenSource

func ComputeTokenSource(account string) oauth2.TokenSource

ComputeTokenSource returns a token source that fetches access tokens from Google Compute Engine (GCE)'s metadata server. It's only valid to use this token source if your program is running on a GCE instance. If no account is specified, "default" is used. Further information about retrieving access tokens from the GCE metadata server can be found at https://cloud.google.com/compute/docs/authentication.

Example
Output:

func JWTConfigFromJSON

func JWTConfigFromJSON(jsonKey []byte, scope ...string) (*jwt.Config, error)

JWTConfigFromJSON uses a Google Developers service account JSON key file to read the credentials that authorize and authenticate the requests. Create a service account on "Credentials" page under "APIs & Auth" for your project at https://console.developers.google.com to download a JSON key file.

Example
Output:

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL