Documentation
¶
Overview ¶
Package oauth provides OAuth2 authentication utilities for productivity providers
Package oauth provides OAuth2 authentication utilities for productivity providers
Index ¶
Constants ¶
const ( DefaultClientID = "99372105068-5admelee1etblg3r556i0slh3cnd0tlo.apps.googleusercontent.com" DefaultClientSecret = "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" //nolint:gosec // G101: Intentional - desktop OAuth client secret DefaultProjectID = "jeff-481417" )
Default OAuth2 credentials for Jeff's Google Cloud project These are safe to embed in desktop applications as they require user consent and local redirect URIs. Similar to how GitHub CLI, gcloud, and other desktop tools handle OAuth credentials.
Variables ¶
This section is empty.
Functions ¶
func GetClientID ¶ added in v0.2.0
func GetClientID() string
GetClientID returns the OAuth2 client ID, checking environment variable first
func GetClientSecret ¶ added in v0.2.0
func GetClientSecret() string
GetClientSecret returns the OAuth2 client secret, checking environment variable first
func GetProjectID ¶ added in v0.2.0
func GetProjectID() string
GetProjectID returns the Google Cloud project ID, checking environment variable first
func HasCredentials ¶ added in v0.2.0
func HasCredentials() bool
HasCredentials returns true if both client ID and secret are available (either from environment variables or embedded defaults)
func IsUsingDefaultCredentials ¶ added in v0.2.0
func IsUsingDefaultCredentials() bool
IsUsingDefaultCredentials returns true if using the embedded default credentials (no environment variable overrides)
Types ¶
type CallbackServer ¶
type CallbackServer struct {
Port int
CodeChan chan string
ErrChan chan error
State string // CSRF protection state
// contains filtered or unexported fields
}
CallbackServer handles OAuth2 callback redirects
func NewCallbackServer ¶
func NewCallbackServer(state string) (*CallbackServer, error)
NewCallbackServer creates a new OAuth callback server on a random port
func (*CallbackServer) RedirectURI ¶
func (cs *CallbackServer) RedirectURI() string
RedirectURI returns the full redirect URI for this server
func (*CallbackServer) Start ¶
func (cs *CallbackServer) Start() error
Start begins listening for OAuth callbacks
func (*CallbackServer) Stop ¶
func (cs *CallbackServer) Stop() error
Stop gracefully shuts down the callback server