login

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

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