workos

package
v1.22.1 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client provides access to WorkOS device code flow authentication.

func NewClient

func NewClient(clientID string, audiences ...string) *Client

NewClient creates a new WorkOS client. Audiences are included in token requests so JWTs contain the aud claim. Both the Tero API and PowerSync validate audience.

func (*Client) AuthorizeDevice

func (c *Client) AuthorizeDevice(ctx context.Context) (*auth.DeviceAuthResponse, error)

AuthorizeDevice initiates the device authorization flow. Returns device_code (for polling), user_code (to show user), and verification URLs.

func (*Client) PollAuthentication

func (c *Client) PollAuthentication(ctx context.Context, deviceCode string) (*auth.AuthenticationResponse, error)

PollAuthentication polls WorkOS to check if the user has completed authentication.

func (*Client) RefreshToken

func (c *Client) RefreshToken(ctx context.Context, refreshToken string) (*auth.RefreshResponse, error)

RefreshToken exchanges a refresh token for a new access token.

func (*Client) RefreshTokenWithOrganization

func (c *Client) RefreshTokenWithOrganization(ctx context.Context, refreshToken string, organizationID domain.WorkosOrganizationID) (*auth.RefreshResponse, error)

RefreshTokenWithOrganization exchanges a refresh token for a new access token scoped to an organization. The organizationID should be the WorkOS organization ID.

Directories

Path Synopsis
Package admin wraps the WorkOS management API for internal admin operations.
Package admin wraps the WorkOS management API for internal admin operations.

Jump to

Keyboard shortcuts

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