Documentation
¶
Index ¶
- Constants
- Variables
- type AdminAuditRequest
- type AdminAuditResponse
- type AdminCreateSSOProviderRequest
- type AdminCreateSSOProviderResponse
- type AdminCreateUserRequest
- type AdminCreateUserResponse
- type AdminDeleteSSOProviderRequest
- type AdminDeleteSSOProviderResponse
- type AdminDeleteUserFactorRequest
- type AdminDeleteUserRequest
- type AdminGenerateLinkRequest
- type AdminGenerateLinkResponse
- type AdminGetSSOProviderRequest
- type AdminGetSSOProviderResponse
- type AdminGetUserRequest
- type AdminGetUserResponse
- type AdminListSSOProvidersResponse
- type AdminListUserFactorsRequest
- type AdminListUserFactorsResponse
- type AdminListUsersResponse
- type AdminUpdateSSOProviderRequest
- type AdminUpdateSSOProviderResponse
- type AdminUpdateUserFactorRequest
- type AdminUpdateUserFactorResponse
- type AdminUpdateUserRequest
- type AdminUpdateUserResponse
- type AuditLogEntry
- type AuditQuery
- type AuditQueryColumn
- type AuthorizeRequest
- type AuthorizeResponse
- type BanDuration
- type ChallengeFactorRequest
- type ChallengeFactorResponse
- type EnrollFactorRequest
- type EnrollFactorResponse
- type ErrInvalidGenerateLinkRequest
- type ExternalProviders
- type Factor
- type FactorType
- type FlowType
- type GoTrueMetaSecurity
- type HealthCheckResponse
- type Identity
- type InviteRequest
- type InviteResponse
- type LinkType
- type MagiclinkRequest
- type OTPRequest
- type PKCEParams
- type Provider
- type RecoverRequest
- type SAMLAttribute
- type SAMLAttributeMapping
- type SAMLProvider
- type SSODomain
- type SSOProvider
- type SSORequest
- type SSOResponse
- type SecurityEmbed
- type Session
- type SettingsResponse
- type SignupRequest
- type SignupResponse
- type TOTPObject
- type TokenRequest
- type TokenResponse
- type UnenrollFactorRequest
- type UnenrollFactorResponse
- type UpdateUserRequest
- type UpdateUserResponse
- type User
- type UserResponse
- type VerificationType
- type VerifyFactorRequest
- type VerifyFactorResponse
- type VerifyForUserRequest
- type VerifyForUserResponse
- type VerifyRequest
- type VerifyResponse
Constants ¶
View Source
const ( VerificationTypeSignup = "signup" VerificationTypeRecovery = "recovery" VerificationTypeInvite = "invite" VerificationTypeMagiclink = "magiclink" VerificationTypeEmailChange = "email_change" VerificationTypeSMS = "sms" VerificationTypePhoneChange = "phone_change" )
Variables ¶
View Source
var ( ErrInvalidAdminAuditRequest = errors.New("admin audit request is invalid - if Query is not nil, then query Column must be author, action or type, and value must be given") ErrInvalidAdminUpdateFactorRequest = errors.New("admin update factor request is invalid - nothing to update") ErrInvalidTokenRequest = errors.New("token request is invalid - grant_type must be password or refresh_token, email and password must be provided for grant_type=password, refresh_token must be provided for grant_type=refresh_token") ErrInvalidVerifyRequest = errors.New("verify request is invalid - type, token and redirect_to must be provided, and email or phone must be provided to VerifyForUser") )
Functions ¶
This section is empty.
Types ¶
type AdminAuditRequest ¶
type AdminAuditRequest struct {
// Query, if provided, is used to search the audit log.
// Logs will be returned where the chosen column matches the value.
Query *AuditQuery
// Pagination
Page uint
PerPage uint
}
type AdminAuditResponse ¶
type AdminAuditResponse struct {
Logs []AuditLogEntry
// Pagination
TotalCount int
TotalPages uint
NextPage uint
}
type AdminCreateSSOProviderResponse ¶
type AdminCreateSSOProviderResponse struct {
SSOProvider
}
type AdminCreateUserRequest ¶
type AdminCreateUserRequest struct {
Aud string `json:"aud,omitempty"`
Role string `json:"role,omitempty"`
Email string `json:"email,omitempty"`
Phone string `json:"phone,omitempty"`
Password *string `json:"password,omitempty"` // Only if type = signup
EmailConfirm bool `json:"email_confirm,omitempty"`
PhoneConfirm bool `json:"phone_confirm,omitempty"`
UserMetadata map[string]interface{} `json:"user_metadata,omitempty"`
AppMetadata map[string]interface{} `json:"app_metadata,omitempty"`
BanDuration time.Duration `json:"ban_duration,omitempty"` // Cannot be "none" when creating a user, so just set it or leave it empty
}
type AdminCreateUserResponse ¶
type AdminCreateUserResponse struct {
User
}
type AdminDeleteSSOProviderResponse ¶
type AdminDeleteSSOProviderResponse struct {
SSOProvider
}
type AdminDeleteUserRequest ¶
type AdminGetSSOProviderResponse ¶
type AdminGetSSOProviderResponse struct {
SSOProvider
}
type AdminGetUserRequest ¶
type AdminGetUserResponse ¶
type AdminGetUserResponse struct {
User
}
type AdminListSSOProvidersResponse ¶
type AdminListSSOProvidersResponse struct {
Providers []SSOProvider `json:"items"`
}
type AdminListUserFactorsResponse ¶
type AdminListUserFactorsResponse struct {
Factors []Factor
}
type AdminListUsersResponse ¶
type AdminListUsersResponse struct {
Users []User `json:"users"`
}
type AdminUpdateSSOProviderRequest ¶
type AdminUpdateSSOProviderRequest struct {
ProviderID uuid.UUID `json:"-"`
ResourceID string `json:"resource_id"`
Type string `json:"type"`
MetadataURL string `json:"metadata_url"`
MetadataXML string `json:"metadata_xml"`
Domains []string `json:"domains"`
AttributeMapping SAMLAttributeMapping `json:"attribute_mapping"`
}
type AdminUpdateSSOProviderResponse ¶
type AdminUpdateSSOProviderResponse struct {
SSOProvider
}
type AdminUpdateUserFactorResponse ¶
type AdminUpdateUserFactorResponse struct {
Factor
}
type AdminUpdateUserRequest ¶
type AdminUpdateUserRequest struct {
UserID uuid.UUID `json:"-"`
Aud string `json:"aud,omitempty"`
Role string `json:"role,omitempty"`
Email string `json:"email,omitempty"`
Phone string `json:"phone,omitempty"`
Password string `json:"password,omitempty"`
EmailConfirm bool `json:"email_confirm,omitempty"`
PhoneConfirm bool `json:"phone_confirm,omitempty"`
UserMetadata map[string]interface{} `json:"user_metadata,omitempty"`
AppMetadata map[string]interface{} `json:"app_metadata,omitempty"`
BanDuration *BanDuration `json:"ban_duration,omitempty"`
}
type AdminUpdateUserResponse ¶
type AdminUpdateUserResponse struct {
User
}
type AuditLogEntry ¶
type AuditQuery ¶
type AuditQuery struct {
Column AuditQueryColumn
Value string
}
type AuditQueryColumn ¶
type AuditQueryColumn string
--- Request/Response Types ---
const ( AuditQueryColumnAuthor AuditQueryColumn = "author" AuditQueryColumnAction AuditQueryColumn = "action" AuditQueryColumnType AuditQueryColumn = "type" )
type AuthorizeRequest ¶
type AuthorizeResponse ¶
type BanDuration ¶
type BanDuration struct {
// contains filtered or unexported fields
}
func BanDurationNone ¶
func BanDurationNone() BanDuration
func BanDurationTime ¶
func BanDurationTime(d time.Duration) BanDuration
func (BanDuration) MarshalJSON ¶
func (b BanDuration) MarshalJSON() ([]byte, error)
func (BanDuration) String ¶
func (b BanDuration) String() string
func (*BanDuration) UnmarshalJSON ¶
func (b *BanDuration) UnmarshalJSON(data []byte) error
func (BanDuration) Value ¶
func (b BanDuration) Value() *time.Duration
type ChallengeFactorRequest ¶
type ChallengeFactorResponse ¶
type EnrollFactorRequest ¶
type EnrollFactorRequest struct {
FriendlyName string `json:"friendly_name"`
FactorType FactorType `json:"factor_type"`
Issuer string `json:"issuer"`
}
type EnrollFactorResponse ¶
type EnrollFactorResponse struct {
ID uuid.UUID `json:"id"`
Type FactorType `json:"type"`
TOTP TOTPObject `json:"totp,omitempty"`
}
type ErrInvalidGenerateLinkRequest ¶
type ErrInvalidGenerateLinkRequest struct {
// contains filtered or unexported fields
}
func NewErrInvalidGenerateLinkRequest ¶
func NewErrInvalidGenerateLinkRequest(message string) *ErrInvalidGenerateLinkRequest
func (*ErrInvalidGenerateLinkRequest) Error ¶
func (e *ErrInvalidGenerateLinkRequest) Error() string
type ExternalProviders ¶
type ExternalProviders struct {
Apple bool `json:"apple"`
Azure bool `json:"azure"`
Bitbucket bool `json:"bitbucket"`
Discord bool `json:"discord"`
Email bool `json:"email"`
Facebook bool `json:"facebook"`
GitHub bool `json:"github"`
GitLab bool `json:"gitlab"`
Google bool `json:"google"`
Keycloak bool `json:"keycloak"`
Linkedin bool `json:"linkedin"`
Notion bool `json:"notion"`
Phone bool `json:"phone"`
SAML bool `json:"saml"`
Slack bool `json:"slack"`
Spotify bool `json:"spotify"`
Twitch bool `json:"twitch"`
Twitter bool `json:"twitter"`
WorkOS bool `json:"workos"`
Zoom bool `json:"zoom"`
}
type GoTrueMetaSecurity ¶
type GoTrueMetaSecurity struct {
CaptchaToken string `json:"captcha_token"`
}
type HealthCheckResponse ¶
type Identity ¶
type Identity struct {
ID string `json:"id"`
UserID uuid.UUID `json:"user_id"`
IdentityData map[string]interface{} `json:"identity_data,omitempty"`
Provider string `json:"provider"`
LastSignInAt *time.Time `json:"last_sign_in_at,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type InviteRequest ¶
type InviteResponse ¶
type InviteResponse struct {
User
}
type MagiclinkRequest ¶
type MagiclinkRequest struct {
Email string `json:"email"`
// Provide Captcha token if enabled.
SecurityEmbed
}
DEPRECATED: Use /otp with Email and CreateUser=true instead of /magiclink.
type OTPRequest ¶
type OTPRequest struct {
Email string `json:"email"`
Phone string `json:"phone"`
CreateUser bool `json:"create_user"`
Data map[string]interface{} `json:"data"`
// Provide Captcha token if enabled.
SecurityEmbed
}
type PKCEParams ¶ added in v1.1.0
adapted from https://go-review.googlesource.com/c/oauth2/+/463979/9/pkce.go#64
type Provider ¶
type Provider string
const ( ProviderApple Provider = "apple" ProviderAzure Provider = "azure" ProviderBitbucket Provider = "bitbucket" ProviderDiscord Provider = "discord" ProviderGitHub Provider = "github" ProviderGitLab Provider = "gitlab" ProviderGoogle Provider = "google" ProviderKeycloak Provider = "keycloak" ProviderLinkedin Provider = "linkedin" ProviderFacebook Provider = "facebook" ProviderNotion Provider = "notion" ProviderSpotify Provider = "spotify" ProviderSlack Provider = "slack" ProviderTwitch Provider = "twitch" ProviderTwitter Provider = "twitter" ProviderWorkOS Provider = "workos" ProviderZoom Provider = "zoom" )
type RecoverRequest ¶
type RecoverRequest struct {
Email string `json:"email"`
// Provide Captcha token if enabled.
SecurityEmbed
}
type SAMLAttribute ¶
type SAMLAttributeMapping ¶
type SAMLAttributeMapping struct {
Keys map[string]SAMLAttribute `json:"keys,omitempty"`
}
type SAMLProvider ¶
type SAMLProvider struct {
EntityID string `json:"entity_id"`
MetadataXML string `json:"metadata_xml,omitempty"`
MetadataURL *string `json:"metadata_url,omitempty"`
AttributeMapping SAMLAttributeMapping `json:"attribute_mapping,omitempty"`
}
type SSOProvider ¶
type SSORequest ¶
type SSOResponse ¶
type SecurityEmbed ¶
type SecurityEmbed struct {
Security GoTrueMetaSecurity `json:"gotrue_meta_security"`
}
type SettingsResponse ¶
type SettingsResponse struct {
DisableSignup bool `json:"disable_signup"`
Autoconfirm bool `json:"autoconfirm"`
MailerAutoconfirm bool `json:"mailer_autoconfirm"`
PhoneAutoconfirm bool `json:"phone_autoconfirm"`
SmsProvider string `json:"sms_provider"`
MFAEnabled bool `json:"mfa_enabled"`
External ExternalProviders `json:"external"`
}
type SignupRequest ¶
type SignupRequest struct {
Email string `json:"email,omitempty"`
Phone string `json:"phone,omitempty"`
Password string `json:"password,omitempty"`
Data map[string]interface{} `json:"data,omitempty"`
// Provide Captcha token if enabled.
SecurityEmbed
}
type SignupResponse ¶
type TOTPObject ¶
type TokenRequest ¶
type TokenRequest struct {
GrantType string `json:"-"`
// Email or Phone, and Password, are required if GrantType is 'password'.
// They must not be provided if GrantType is 'refresh_token'.
Email string `json:"email,omitempty"`
Phone string `json:"phone,omitempty"`
Password string `json:"password,omitempty"`
// RefreshToken is required if GrantType is 'refresh_token'.
// It must not be provided if GrantType is 'password'.
RefreshToken string `json:"refresh_token,omitempty"`
// Code and CodeVerifier are required if GrantType is 'pkce'.
Code string `json:"code,omitempty"`
// Code and CodeVerifier are required if GrantType is 'pkce'.
CodeVerifier string `json:"code_verifier,omitempty"`
// Provide Captcha token if enabled. Not required if GrantType is 'refresh_token'.
SecurityEmbed
}
type TokenResponse ¶
type TokenResponse struct {
Session
}
type UnenrollFactorRequest ¶
type UnenrollFactorResponse ¶
type UpdateUserRequest ¶
type UpdateUserRequest struct {
Email string `json:"email,omitempty"`
Password *string `json:"password,omitempty"`
Nonce string `json:"nonce,omitempty"`
Data map[string]interface{} `json:"data,omitempty"`
AppData map[string]interface{} `json:"app_metadata,omitempty"`
Phone string `json:"phone,omitempty"`
}
type UpdateUserResponse ¶
type UpdateUserResponse struct {
User
}
type User ¶
type User struct {
ID uuid.UUID `json:"id"`
Aud string `json:"aud"`
Role string `json:"role"`
Email string `json:"email"`
EmailConfirmedAt *time.Time `json:"email_confirmed_at,omitempty"`
InvitedAt *time.Time `json:"invited_at,omitempty"`
Phone string `json:"phone"`
PhoneConfirmedAt *time.Time `json:"phone_confirmed_at,omitempty"`
ConfirmationSentAt *time.Time `json:"confirmation_sent_at,omitempty"`
RecoverySentAt *time.Time `json:"recovery_sent_at,omitempty"`
EmailChange string `json:"new_email,omitempty"`
EmailChangeSentAt *time.Time `json:"email_change_sent_at,omitempty"`
PhoneChange string `json:"new_phone,omitempty"`
PhoneChangeSentAt *time.Time `json:"phone_change_sent_at,omitempty"`
ReauthenticationSentAt *time.Time `json:"reauthentication_sent_at,omitempty"`
LastSignInAt *time.Time `json:"last_sign_in_at,omitempty"`
AppMetadata map[string]interface{} `json:"app_metadata"`
UserMetadata map[string]interface{} `json:"user_metadata"`
Factors []Factor `json:"factors,omitempty"`
Identities []Identity `json:"identities"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
BannedUntil *time.Time `json:"banned_until,omitempty"`
// ConfirmedAt is deprecated. Use EmailConfirmedAt or PhoneConfirmedAt instead.
ConfirmedAt time.Time `json:"confirmed_at"`
}
type UserResponse ¶
type UserResponse struct {
User
}
type VerificationType ¶
type VerificationType string
type VerifyFactorRequest ¶
type VerifyFactorResponse ¶
type VerifyFactorResponse struct {
Session
}
type VerifyForUserRequest ¶
type VerifyForUserRequest struct {
Type VerificationType `json:"type"`
Token string `json:"token"`
RedirectTo string `json:"redirect_to"`
Email string `json:"email"`
Phone string `json:"phone"`
// Provide Captcha token if enabled.
// Not required for server version >= v2.30.1
SecurityEmbed
}
type VerifyForUserResponse ¶
type VerifyForUserResponse struct {
Session
}
type VerifyRequest ¶
type VerifyRequest struct {
Type VerificationType
Token string
RedirectTo string
}
type VerifyResponse ¶
type VerifyResponse struct {
URL string
// The fields below are returned only for a successful response.
AccessToken string
TokenType string
ExpiresIn int
RefreshToken string
Type VerificationType
// The fields below are returned if there was an error verifying.
Error string
ErrorCode string
ErrorDescription string
}
Click to show internal directories.
Click to hide internal directories.