devicecode

package
v0.0.28 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package devicecode implements the OAuth 2.0 Device Authorization Grant.

See https://tools.ietf.org/html/rfc8628

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Config is the OAuth2 configuration to use for this authorization flow
	clientcredentials.Config

	// DeviceAuthorizationURL is the location of the device authorization endpoint
	DeviceAuthorizationURL string
	// EndpointParams specifies additional parameters for requests to the device authorization endpoint.
	EndpointParams url.Values
}

Config describes a device authorization grant (also known as a "device flow").

func (*Config) Token

func (c *Config) Token(ctx context.Context, prompt UserInstruction) (*oauth2.Token, error)

Token uses the device flow to retrieve a token. This function will poll continuously until the end user performs the verification or the device code issued by the authorization server expires.

type UserInstruction

type UserInstruction func(userCode, verificationURI, verificationURIComplete string)

UserInstruction is a function used to tell the end user how to complete the authorization.

Jump to

Keyboard shortcuts

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