Documentation
¶
Overview ¶
Package devin provides OAuth helpers for Devin / Cognition credentials.
Index ¶
- Constants
- func BuildOAuthMetadata(sessionToken, userName, userID, orgID string) map[string]any
- func CredentialFileName(userName, userID string) string
- func DefaultRedirectURI() string
- func FormatSessionToken(rawToken string) string
- type DevinAuthService
- func (s *DevinAuthService) BuildAuthorizationURL(redirectURI, codeChallenge, state string) string
- func (s *DevinAuthService) ExchangeCodeForToken(ctx context.Context, code, codeVerifier string) (string, error)
- func (s *DevinAuthService) FetchSelfProfile(ctx context.Context, sessionToken string) (userName, userID, orgID string, err error)
- type PKCECodes
Constants ¶
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 ¶
BuildOAuthMetadata builds the persisted Devin OAuth credential metadata.
func CredentialFileName ¶
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 ¶
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.