Documentation
¶
Index ¶
Constants ¶
View Source
const ( REDIRECT_URI = "http://localhost:42069/callback" URI = "http://localhost:42069" PORT = "42069" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AccessToken ¶
type AccessToken struct { Token string `json:"access_token"` Expiry time.Time `json:"time_created"` }
func NewAccessToken ¶
func NewAccessToken(str string) *AccessToken
func (*AccessToken) Load ¶
func (t *AccessToken) Load(c *config.Config) error
Loads the access token from token file
func (*AccessToken) Refresh ¶
func (t *AccessToken) Refresh(refreshToken *RefreshToken, c *config.Config) error
Refreshes the access token via valid refresh token. Then updates the token string and token file.
type RefreshToken ¶
type RefreshToken struct {
Token string `json:"refresh_token"`
}
func NewRefreshToken ¶
func NewRefreshToken(tok string) *RefreshToken
type Session ¶
type Session struct { AccessToken *AccessToken RefreshToken *RefreshToken }
func (*Session) Authenticate ¶
Authenticate is set to only run checks after the access token expiry period has elapsed. This is for faster runtime, should be perfectly okay unless token files are externally tappered. Checks if the access token is valid. If not, refreshes the access token. If the access token is not valid, reauthenticates s. Updating the token file.
Click to show internal directories.
Click to hide internal directories.