auth

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 26, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authentication

type Authentication struct {
	DeviceCode     string `json:"device_code"`
	UserCode       string `json:"user_code"`
	VerficationURL string `json:"verification_url"`
}

Authentication is used to exchange the keys with the oauth2 API

func GetVerificationURL

func GetVerificationURL(clientID string) (auth Authentication, err error)

GetVerificationURL returns an url for the verification

type Credentials

type Credentials struct {
	ClientID     string `json:"client_id" url:"client_id,ifStringIsNotEmpty"`
	ClientSecret string `json:"client_secret" url:"client_secret,ifStringIsNotEmpty"`
	Code         string `json:"-" url:"code,ifStringIsNotEmpty"`
	GrantType    string `json:"-" url:"grant_type,ifStringIsNotEmpty"`
	AccessToken  string `json:"access_token" url:"-"`
}

Credentials represents the informations to get a token, there are saved in `~/$CONFIG/c14-cli/c14rc.json`

func GenerateCredentials

func GenerateCredentials(clientID, deviceCode string) (c Credentials, err error)

GenerateCredentials calls the oauth2 API to get the credentials

func GetCredentials

func GetCredentials() (c *Credentials, err error)

GetCredentials returns the C14 credentials file

func (*Credentials) Save

func (c *Credentials) Save() (err error)

Save writes the credentials file

func (*Credentials) Token

func (c *Credentials) Token() (t *oauth2.Token, err error)

Token oauth2.TokenSource implementation

Jump to

Keyboard shortcuts

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