googoauth

package module
v0.0.0-...-ca2db6b Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2018 License: Apache-2.0 Imports: 20 Imported by: 1

README

googoauth

Google OAuth helper library

So, you want to make an OAuth connection to Google?

This library encapsulates the wisdom of having done it for a few applications. It attempts to provide as simple an interface as possible for quick command-line applications that need to persist credentials via OAuth.

For a simple example usage, see https://github.com/asjoyner/add_alias

Documentation

Overview

Completely courtesy this example: github.com/google/google-api-go-client/examples/debug.go

Index

Constants

This section is empty.

Variables

View Source
var (
	DeviceCodeURL    = "https://accounts.google.com/o/oauth2/device/code"
	TokenPollURL     = "https://www.googleapis.com/oauth2/v3/token"
	DeviceGrantType  = "http://oauth.net/grant_type/device/1.0"
	DeviceCodeScopes = map[string]struct{}{
		"profile": struct{}{},
		"openid":  struct{}{},
		"email":   struct{}{},
		"https://www.googleapis.com/auth/analytics":               struct{}{},
		"https://www.googleapis.com/auth/analytics.readonly":      struct{}{},
		"https://www.googleapis.com/auth/calendar":                struct{}{},
		"https://www.googleapis.com/auth/calendar.readonly":       struct{}{},
		"https://www.google.com/m8/feeds":                         struct{}{},
		"https://www.googleapis.com/auth/contacts.readonly":       struct{}{},
		"https://www.googleapis.com/auth/cloudprint":              struct{}{},
		"https://www.googleapis.com/auth/devstorage.full_control": struct{}{},
		"https://www.googleapis.com/auth/devstorage.read_write":   struct{}{},
		"https://www.googleapis.com/auth/fitness.activity.read":   struct{}{},
		"https://www.googleapis.com/auth/fitness.activity.write":  struct{}{},
		"https://www.googleapis.com/auth/fitness.body.read":       struct{}{},
		"https://www.googleapis.com/auth/fitness.body.write":      struct{}{},
		"https://www.googleapis.com/auth/fitness.location.read":   struct{}{},
		"https://www.googleapis.com/auth/fitness.location.write":  struct{}{},
		"https://www.googleapis.com/auth/fusiontables":            struct{}{},
		"https://www.googleapis.com/auth/youtube":                 struct{}{},
		"https://www.googleapis.com/auth/youtube.readonly":        struct{}{},
		"https://www.googleapis.com/auth/youtube.upload":          struct{}{},
		"https://www.googleapis.com/auth/drive.file":              struct{}{},
	}
)

Functions

func Client

func Client(id, secret string, scope []string) *http.Client

Client accepts the connection details, and makes an oAuth connection

id and secret are the CLIENT ID and CLIENT SECRET which you can generate at the Google Developer Console: http://console.developers.google.com You want an "Installed Application" of type "Other".

Scope defines the access you are requesting, it is specific to the application. Strings are URLs, eg. "https://www.googleapis.com/auth/calendar", typically accessed in Go via the constants in the Go API, eg. directory.AdminDirectoryGroupScope

Types

This section is empty.

Jump to

Keyboard shortcuts

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