Documentation ¶
Overview ¶
Package tokensource has a Golang OAuth2 Token Source that notifies the refresh operations.
This is useful to react to those events and store the new token in your database.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Notify ¶
Notify is an oauth2.TokenSource that tracks changes in the token to be able to store the updated token after finishing the operations.
func NewNotify ¶
NewNotify builds a new oauth2.TokenSource that alerts when a token changes when calling HasChanged() after finishing all calls.
func NewNotifyHook ¶
func NewNotifyHook(ctx context.Context, config *oauth2.Config, token *oauth2.Token, hook UpdateHook) *Notify
NewNotifyHook builds a new oauth2.TokenSource that alerts when a token changes through a hook that will be called when it happens.
func (*Notify) Client ¶
Client builds an OAuth2-authenticated HTTP client like oauth2.Config.Client does.
func (*Notify) HasChanged ¶
HasChanged returns if we have a new token different from the one passed to NewNotify.
type UpdateHook ¶
UpdateHook is a function that can be passed to the constructor that will be called when the token updates.