Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Auth ¶
type Auth struct { UserEmail string Storage *TokenStore }
Auth is XOAUTH2 implementation of smtp.Auth interface.
type Credentials ¶
type Credentials struct { ClientID string `json:"client_id"` ClientSecret string `json:"client_secret"` TokenURI string `json:"token_uri"` }
Credentials represents OAuth2 credentials.
type Token ¶
type Token struct { AccessToken string `json:"access_token"` RefreshToken string `json:"refresh_token"` Type string `json:"token_type"` Expiry time.Time `json:"expiry"` }
Token represents OAuth2 token.
func RefreshToken ¶
func RefreshToken(ctx context.Context, creds Credentials, refreshToken string) (_ *Token, err error)
RefreshToken is a helper method that refreshes token with given credentials and OUATH2 refresh token.
type TokenStore ¶
type TokenStore struct {
// contains filtered or unexported fields
}
TokenStore is a thread safe storage for OAuth2 token and credentials.
func NewTokenStore ¶
func NewTokenStore(creds Credentials, token Token) *TokenStore
NewTokenStore creates new instance of token storage.
Click to show internal directories.
Click to hide internal directories.