oauth2x

package
v0.0.0-...-fb49ba0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 7, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package oauth2x contains helpers for the oauth2 package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Equals

func Equals(x, y *oauth2.Token) bool

Equals checks that two tokens are equal by the following rules:

- AccessToken, TokenType, and RefreshToken must be identical. - Expiry must match within one second.

func NewOnNew

func NewOnNew(ts oauth2.TokenSource, onNew func(*oauth2.Token, error)) oauth2.TokenSource

NewOnNew creates a token source which calls onNew when a new token is created, passing the new token and an error (if any occurred while fetching it). If onNew is nil, then the token source returned is equivalent to one returned by oauth2.ReuseTokenSource.

onNew is called synchronously under lock and will block other uses of this token source. If a non-blocking operation is desired, create a new goroutine in onNew.

func NewOnNewWithToken

func NewOnNewWithToken(ts oauth2.TokenSource, onNew func(*oauth2.Token, error), tok *oauth2.Token) oauth2.TokenSource

NewOnNewWithToken is the same as OnNew, but uses tok as the first token instead of calling out to the wrapped token source first. If this token is no longer valid, then the wrapped token source will be called, as would be done for any expiry.

Types

type TokenSource

type TokenSource = oauth2.TokenSource

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL