login

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: Apache-2.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	ClientID              = "e6506150369268abae3ed46152687201"
	MaxFetchTokenAttempts = 120 // two minutes assuming interval is one second
	TokenInterval         = 1 * time.Second
)

Variables

This section is empty.

Functions

func FetchToken

func FetchToken(
	client resources.UnauthenticatedClient,
	deviceCode string,
	baseURI string,
	interval time.Duration,
	maxAttempts int,
) (string, error)

FetchToken attempts to get an access token. It will continue to try while the user logs in to verify their request. If the user denies the request or does nothing long enough for this call to time out, we do not return an access token.

func GetDeviceName

func GetDeviceName() string

Types

type DeviceAuthorization

type DeviceAuthorization struct {
	DeviceCode      string `json:"deviceCode"`
	ExpiresIn       int    `json:"expiresIn"`
	UserCode        string `json:"userCode"`
	VerificationURI string `json:"verificationUri"`
}

func FetchDeviceAuthorization

func FetchDeviceAuthorization(
	client resources.UnauthenticatedClient,
	clientID string,
	deviceName string,
	baseURI string,
) (DeviceAuthorization, error)

FetchDeviceAuthorization makes a request to create a device authorization that will later be used to set a local access token if the user grants access.

type DeviceAuthorizationToken

type DeviceAuthorizationToken struct {
	AccessToken string `json:"accessToken"`
}

Jump to

Keyboard shortcuts

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