Documentation ¶
Index ¶
Constants ¶
View Source
const APITokenLifeSpan = 31536000
View Source
const AccessTokenLifeSpan = 36000
View Source
const RefreshTokenLifeSpan = 864000
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APITokenResponse ¶
type APITokenResponse struct { ExpiresIn int64 `json:"expiresIn"` APIToken string `json:"apiToken" sql:"-"` }
func CreateAPIToken ¶
func CreateAPIToken(userID int64) (*APITokenResponse, error)
type JSONWebToken ¶
type JSONWebToken struct { UserID int64 `json:"userID"` jwt.StandardClaims }
type RefreshJWTReq ¶
type TokenResponse ¶
type TokenResponse struct { ExpiresIn int64 `json:"expiresIn"` AccessToken string `json:"accessToken" sql:"-"` RefreshToken string `json:"refreshToken" sql:"-"` }
func CreateToken ¶
func CreateToken(userID int64) (*TokenResponse, error)
func RefreshToken ¶
func RefreshToken(rawToken string) (*TokenResponse, error)
Click to show internal directories.
Click to hide internal directories.