token

package
v2.3.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Token

type Token struct {
	AccessToken string `json:"access_token"`
	TokenType   string `json:"token_type"`
}

Token represents the json structure that will be returned from the device after successfull authentication. The token can be used for further API calls and needs to be encoded in the 'authorization' field of the http header.

func (*Token) String

func (t *Token) String() string

String builds the token string which is used in the 'authorization' field of the http header.

type TokenManager

type TokenManager struct {
	Url        string
	Username   string
	Password   string
	Connection *http.Client

	Token Token
	// contains filtered or unexported fields
}

func (*TokenManager) CheckAuthToken

func (m *TokenManager) CheckAuthToken() (isValid bool, err error)

CheckAuthToken checks if the tokenManager has valid authentication token.

func (*TokenManager) RequestAuthToken

func (m *TokenManager) RequestAuthToken() (Token, error)

RequestAuthToken gets a valid authentication token from the ctrlX CORE using username and password. The token is necessary to create a subscription. An error will be returned, when no token could get aquired.

Jump to

Keyboard shortcuts

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