oauth

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package oauth exchanges OAuth grants with Linear's token endpoint.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CodeChallengeS256

func CodeChallengeS256(verifier string) string

CodeChallengeS256 returns the RFC 7636 S256 challenge for a verifier.

Types

type AuthorizationCodeRequest

type AuthorizationCodeRequest struct {
	Code         string
	RedirectURI  string
	ClientID     string
	ClientSecret string
	CodeVerifier string
}

AuthorizationCodeRequest describes a PKCE authorization-code token exchange.

type Client

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

Client exchanges OAuth grants with Linear.

func NewClient

func NewClient(config ClientConfig) *Client

NewClient returns a Linear OAuth token client.

func (*Client) ClientCredentials

func (client *Client) ClientCredentials(
	ctx context.Context,
	request ClientCredentialsRequest,
) (auth.TokenState, error)

ClientCredentials obtains an app actor access token.

func (*Client) ExchangeAuthorizationCode

func (client *Client) ExchangeAuthorizationCode(
	ctx context.Context,
	request AuthorizationCodeRequest,
) (auth.TokenState, error)

ExchangeAuthorizationCode exchanges a PKCE authorization code for tokens.

func (*Client) RefreshToken

func (client *Client) RefreshToken(ctx context.Context, request RefreshTokenRequest) (auth.TokenState, error)

RefreshToken exchanges a refresh token and returns Linear's rotated token state.

func (*Client) RevokeToken

func (client *Client) RevokeToken(ctx context.Context, request RevocationRequest) error

RevokeToken revokes an OAuth access or refresh token.

type ClientConfig

type ClientConfig struct {
	Endpoint           string
	RevocationEndpoint string
	HTTPClient         *http.Client
	Now                func() time.Time
}

ClientConfig configures a Linear OAuth token client.

type ClientCredentialsRequest

type ClientCredentialsRequest struct {
	ClientID     string
	ClientSecret string
	Scopes       []string
}

ClientCredentialsRequest describes an app actor token exchange.

type PKCE

type PKCE struct {
	CodeVerifier        string
	CodeChallenge       string
	CodeChallengeMethod string
}

PKCE carries the verifier and S256 challenge used by OAuth login.

func GeneratePKCE

func GeneratePKCE() (PKCE, error)

GeneratePKCE returns a fresh PKCE verifier and S256 challenge.

type RefreshTokenRequest

type RefreshTokenRequest struct {
	RefreshToken string
	ClientID     string
	ClientSecret string
}

RefreshTokenRequest describes an OAuth refresh-token exchange.

type RevocationRequest

type RevocationRequest struct {
	Token         string
	TokenTypeHint string
}

RevocationRequest describes an OAuth token revocation request.

Jump to

Keyboard shortcuts

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