devin

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package devin provides OAuth helpers for Devin / Cognition credentials.

Index

Constants

View Source
const (
	// DefaultAppBaseURL is the user-facing web app for Devin OAuth.
	DefaultAppBaseURL = "https://app.devin.ai"
	// DefaultAPIBaseURL is the API backend for token exchange and user status.
	DefaultAPIBaseURL = "https://api.devin.ai"
	// DefaultServerURL is the upstream Codeium/Devin reasoning backend.
	DefaultServerURL = "https://server.codeium.com"
	// RedirectHost is the loopback host used by Devin OAuth.
	RedirectHost = "127.0.0.1"
	// CallbackPort is the preferred loopback callback port.
	CallbackPort = 57121
	// RedirectPath is the loopback callback path used by Devin OAuth.
	RedirectPath = "/callback"
)

Variables

This section is empty.

Functions

func BuildOAuthMetadata

func BuildOAuthMetadata(sessionToken, userName, userID, orgID string) map[string]any

BuildOAuthMetadata builds the persisted Devin OAuth credential metadata.

func CredentialFileName

func CredentialFileName(userName, userID string) string

CredentialFileName returns the filename used for Devin credentials.

func DefaultRedirectURI

func DefaultRedirectURI() string

DefaultRedirectURI returns the loopback callback URL used by Home OAuth.

func FormatSessionToken

func FormatSessionToken(rawToken string) string

FormatSessionToken ensures the token carries the mandatory devin-session-token$ prefix.

Types

type DevinAuthService

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

DevinAuthService coordinates Devin PKCE authorization and token exchange.

func NewDevinAuthService

func NewDevinAuthService(cfg *config.Config) *DevinAuthService

NewDevinAuthService creates a Devin authentication helper using config proxy settings.

func NewDevinAuthServiceWithProxyURL

func NewDevinAuthServiceWithProxyURL(cfg *config.Config, proxyURL string) *DevinAuthService

NewDevinAuthServiceWithProxyURL creates a Devin authentication helper with an explicit proxy URL.

func (*DevinAuthService) BuildAuthorizationURL

func (s *DevinAuthService) BuildAuthorizationURL(redirectURI, codeChallenge, state string) string

BuildAuthorizationURL constructs the PKCE login URL.

func (*DevinAuthService) ExchangeCodeForToken

func (s *DevinAuthService) ExchangeCodeForToken(ctx context.Context, code, codeVerifier string) (string, error)

ExchangeCodeForToken exchanges the authorization code for a session token.

func (*DevinAuthService) FetchSelfProfile

func (s *DevinAuthService) FetchSelfProfile(ctx context.Context, sessionToken string) (userName, userID, orgID string, err error)

FetchSelfProfile retrieves the authenticated user's profile from api.devin.ai/v3/self.

type PKCECodes

type PKCECodes struct {
	CodeVerifier  string
	CodeChallenge string
}

PKCECodes contains the PKCE code verifier and code challenge pair.

func GeneratePKCECodes

func GeneratePKCECodes() (*PKCECodes, error)

GeneratePKCECodes generates a random code verifier and its S256 challenge.

Jump to

Keyboard shortcuts

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