workos

package
v0.0.0-...-5e604c0 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2025 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound        = errors.New("no token found")
	ErrUnauthenticated = errors.New("unauthenticated")
)
View Source
var ErrPortNotAvailable = fmt.Errorf("port %d is not available, unable to start local auth callback server", LOCAL_PKCE_CALLBACK_PORT)

ErrPortNotAvailable is returned when the local auth callback port is not available.

View Source
var LOCAL_PKCE_CALLBACK_PORT = 48321

The port that the local auth callback server will listen on. This is used to handle the callback from the WorkOS auth provider.

Functions

This section is empty.

Types

type CallbackResult

type CallbackResult struct {
	Tokens *Tokens
	Error  error
}

type CodeVerifier

type CodeVerifier struct {
	Verifier  string
	Challenge string
}

type KeyringTokenStore

type KeyringTokenStore struct {
	// contains filtered or unexported fields
}

func NewKeyringTokenStore

func NewKeyringTokenStore(serviceName, tokenKey string) (*KeyringTokenStore, error)

func (*KeyringTokenStore) Clear

func (s *KeyringTokenStore) Clear() error

func (*KeyringTokenStore) GetTokens

func (s *KeyringTokenStore) GetTokens() (*Tokens, error)

func (*KeyringTokenStore) SaveTokens

func (s *KeyringTokenStore) SaveTokens(tokens *Tokens) error

type TokenStore

type TokenStore interface {
	// GetTokens returns the tokens from the store, or nil if no tokens are found
	GetTokens() (*Tokens, error)
	// SaveTokens saves the tokens to the store
	SaveTokens(*Tokens) error
	// Clear clears the tokens from the store
	Clear() error
}

type Tokens

type Tokens struct {
	AccessToken  string     `json:"access_token"`
	RefreshToken string     `json:"refresh_token"`
	User         *http.User `json:"user"`
}

type WorkOSAuth

type WorkOSAuth struct {
	// contains filtered or unexported fields
}

func NewWorkOSAuth

func NewWorkOSAuth(inj do.Injector) (*WorkOSAuth, error)

func (*WorkOSAuth) GetAccessToken

func (a *WorkOSAuth) GetAccessToken(forceRefresh bool) (string, error)

func (*WorkOSAuth) Login

func (a *WorkOSAuth) Login() (*http.User, error)

func (*WorkOSAuth) Logout

func (a *WorkOSAuth) Logout() error

func (*WorkOSAuth) RefreshTokenForOrganization

func (a *WorkOSAuth) RefreshTokenForOrganization(organizationId string) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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