Documentation ¶
Index ¶
Constants ¶
View Source
const CREDENTIAL_KEY = "credentials"
Variables ¶
View Source
var ( ErrCredentialsNotFound = errors.New("credentials not found") ErrInvalidCredentialsStored = errors.New("invalid credentials stored") ErrInvalidCredentialsFields = errors.New("invalid credentials fields") )
View Source
var ( ErrRequiredEnvEmpty = errors.New("required env empty") ErrStatusNotOk = errors.New("status not ok") )
Functions ¶
func CalcExpirationRemaining ¶
func CalcExpirationRemaining(cred *ApiCredentials) time.Duration
func SaveCredentials ¶
func SaveCredentials(cred *ApiCredentials) (err error)
Types ¶
type ApiCredentials ¶
type ApiCredentials struct { ExpiresIn int `json:"expires_in"` RefreshedAt time.Time `json:"refreshed_at"` AccessToken string `json:"access_token"` RefreshToken string `json:"refresh_token"` }
func GetCredentialsCache ¶
func GetCredentialsCache() (cred *ApiCredentials, err error)
func GetToken ¶
func GetToken() (cred *ApiCredentials, err error)
func LoadCredentials ¶
func LoadCredentials() (cred *ApiCredentials, err error)
func RefreshToken ¶
func RefreshToken() (cred *ApiCredentials, err error)
func (*ApiCredentials) IsValid ¶
func (cred *ApiCredentials) IsValid() bool
func (*ApiCredentials) SaveCache ¶
func (cred *ApiCredentials) SaveCache()
Click to show internal directories.
Click to hide internal directories.