Documentation
¶
Index ¶
- func BuildAuthorizeURL(cfg OAuthProviderConfig, pkce PKCECodes, state, redirectURI string) string
- func DeleteAllCredentials() error
- func DeleteCredential(provider string) error
- func SaveStore(store *AuthStore) error
- func SetCredential(provider string, cred *AuthCredential) error
- type AuthCredential
- func GetCredential(provider string) (*AuthCredential, error)
- func LoginBrowser(cfg OAuthProviderConfig) (*AuthCredential, error)
- func LoginDeviceCode(cfg OAuthProviderConfig) (*AuthCredential, error)
- func LoginPasteToken(provider string, r io.Reader) (*AuthCredential, error)
- func RefreshAccessToken(cred *AuthCredential, cfg OAuthProviderConfig) (*AuthCredential, error)
- type AuthStore
- type OAuthProviderConfig
- type PKCECodes
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildAuthorizeURL ¶
func BuildAuthorizeURL(cfg OAuthProviderConfig, pkce PKCECodes, state, redirectURI string) string
func DeleteAllCredentials ¶
func DeleteAllCredentials() error
func DeleteCredential ¶
func SetCredential ¶
func SetCredential(provider string, cred *AuthCredential) error
Types ¶
type AuthCredential ¶
type AuthCredential struct {
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token,omitempty"`
AccountID string `json:"account_id,omitempty"`
ExpiresAt time.Time `json:"expires_at,omitempty"`
Provider string `json:"provider"`
AuthMethod string `json:"auth_method"`
}
func GetCredential ¶
func GetCredential(provider string) (*AuthCredential, error)
func LoginBrowser ¶
func LoginBrowser(cfg OAuthProviderConfig) (*AuthCredential, error)
func LoginDeviceCode ¶
func LoginDeviceCode(cfg OAuthProviderConfig) (*AuthCredential, error)
func LoginPasteToken ¶
func LoginPasteToken(provider string, r io.Reader) (*AuthCredential, error)
func RefreshAccessToken ¶
func RefreshAccessToken(cred *AuthCredential, cfg OAuthProviderConfig) (*AuthCredential, error)
func (*AuthCredential) IsExpired ¶
func (c *AuthCredential) IsExpired() bool
func (*AuthCredential) NeedsRefresh ¶
func (c *AuthCredential) NeedsRefresh() bool
type AuthStore ¶
type AuthStore struct {
Credentials map[string]*AuthCredential `json:"credentials"`
}
type OAuthProviderConfig ¶
type OAuthProviderConfig struct {
Issuer string
ClientID string
Scopes string
Originator string
Port int
}
func OpenAIOAuthConfig ¶
func OpenAIOAuthConfig() OAuthProviderConfig
Click to show internal directories.
Click to hide internal directories.