Versions in this module Expand all Collapse all v1 v1.4.0 Aug 15, 2026 v1.3.0 Jul 22, 2026 v1.2.0 Jun 28, 2026 v1.1.2 Jun 28, 2026 Changes in this version + const APIVersionHeaderName + const DefaultQRSize + const DuplicateEmailMsg + const DuplicatePhoneMsg + const EmailProvider + const InvalidChannelError + const InvalidLoginMessage + const InvalidNonceMessage + const InvalidPKCEParamsErrorMessage + const MaxCodeChallengeLength + const MaxPasswordLength + const MinCodeChallengeLength + const PKCEPrefix + const PhoneProvider + const QRCodeGenerationErrorMessage + const SAMLSubjectIDAttributeName + var APIVersion20240101 = time.Date(2024, time.January, 1, 0, 0, 0, 0, time.UTC) + var APIVersionInitial = time.Time + var EmailRateLimitExceeded error = errors.New("email rate limit exceeded") + var UserExistsError error = errors.New("user already exists") + func FormatAPIVersion(apiVersion APIVersion) string + func HandleHealth(w http.ResponseWriter, r *http.Request) + func HandleLiveness(w http.ResponseWriter, r *http.Request) + func HandleReadiness(db interface{ ... }, upstreamURLs map[string]string) http.HandlerFunc + func HandleResponseError(err error, w http.ResponseWriter, r *http.Request) + func IsSAMLMetadataStale(idpMetadata *saml.EntityDescriptor, samlProvider models.SAMLProvider) bool + type API struct + func NewAPI(globalConfig *conf.GlobalConfiguration, db *storage.Connection, opt ...Option) *API + func NewAPIWithVersion(globalConfig *conf.GlobalConfiguration, db *storage.Connection, version string, ...) *API + func (a *API) ChallengeFactor(w http.ResponseWriter, r *http.Request) error + func (a *API) DeleteIdentity(w http.ResponseWriter, r *http.Request) error + func (a *API) DeliverInboundSendEmailHook(r *http.Request, in *v0hooks.SendEmailInput) error + func (a *API) EnrollFactor(w http.ResponseWriter, r *http.Request) error + func (a *API) ExternalProviderCallback(w http.ResponseWriter, r *http.Request) error + func (a *API) ExternalProviderRedirect(w http.ResponseWriter, r *http.Request) error + func (a *API) GetConfig() *conf.GlobalConfiguration + func (a *API) GetDB() *storage.Connection + func (a *API) GetExternalProviderRedirectURL(w http.ResponseWriter, r *http.Request, linkingTargetUser *models.User) (string, error) + func (a *API) GetTokenService() *tokens.Service + func (a *API) HealthCheck(w http.ResponseWriter, r *http.Request) error + func (a *API) IdTokenGrant(ctx context.Context, w http.ResponseWriter, r *http.Request) error + func (a *API) Invite(w http.ResponseWriter, r *http.Request) error + func (a *API) LinkIdentity(w http.ResponseWriter, r *http.Request) error + func (a *API) Logout(w http.ResponseWriter, r *http.Request) error + func (a *API) MagicLink(w http.ResponseWriter, r *http.Request) error + func (a *API) Mailer() mailer.Mailer + func (a *API) Now() time.Time + func (a *API) OAuthProvider(ctx context.Context, name string) (provider.OAuthProvider, conf.OAuthProviderConfiguration, error) + func (a *API) Otp(w http.ResponseWriter, r *http.Request) error + func (a *API) PKCE(ctx context.Context, w http.ResponseWriter, r *http.Request) error + func (a *API) PasskeyRegistrationOptions(w http.ResponseWriter, r *http.Request) error + func (a *API) PasskeyRegistrationVerify(w http.ResponseWriter, r *http.Request) error + func (a *API) Provider(ctx context.Context, name string, scopes string) (provider.Provider, conf.OAuthProviderConfiguration, error) + func (a *API) Reauthenticate(w http.ResponseWriter, r *http.Request) error + func (a *API) Recover(w http.ResponseWriter, r *http.Request) error + func (a *API) RefreshTokenGrant(ctx context.Context, w http.ResponseWriter, r *http.Request) error + func (a *API) Resend(w http.ResponseWriter, r *http.Request) error + func (a *API) ResourceOwnerPasswordGrant(ctx context.Context, w http.ResponseWriter, r *http.Request) error + func (a *API) SAMLMetadata(w http.ResponseWriter, r *http.Request) error + func (a *API) SamlAcs(w http.ResponseWriter, r *http.Request) error + func (a *API) ServeHTTP(w http.ResponseWriter, r *http.Request) + func (a *API) Settings(w http.ResponseWriter, r *http.Request) error + func (a *API) Signup(w http.ResponseWriter, r *http.Request) error + func (a *API) SignupAnonymously(w http.ResponseWriter, r *http.Request) error + func (a *API) SingleSignOn(w http.ResponseWriter, r *http.Request) error + func (a *API) SmsOtp(w http.ResponseWriter, r *http.Request) error + func (a *API) Token(w http.ResponseWriter, r *http.Request) error + func (a *API) UnenrollFactor(w http.ResponseWriter, r *http.Request) error + func (a *API) UserGet(w http.ResponseWriter, r *http.Request) error + func (a *API) UserUpdate(w http.ResponseWriter, r *http.Request) error + func (a *API) Verify(w http.ResponseWriter, r *http.Request) error + func (a *API) VerifyFactor(w http.ResponseWriter, r *http.Request) error + func (a *API) Version() string + func (a *API) Web3Grant(ctx context.Context, w http.ResponseWriter, r *http.Request) error + func (a *API) WellKnownJwks(w http.ResponseWriter, r *http.Request) error + func (a *API) WellKnownOpenID(w http.ResponseWriter, r *http.Request) error + type APIVersion = time.Time + func DetermineClosestAPIVersion(date string) (APIVersion, error) + type AccessTokenClaims = tokens.AccessTokenClaims + type AccessTokenResponse = tokens.AccessTokenResponse + type AdminCustomOAuthProviderParams struct + AcceptableClientIDs []string + AttributeMapping map[string]interface{} + AuthorizationParams map[string]interface{} + AuthorizationURL string + ClientID string + ClientSecret string + DiscoveryURL *string + EmailOptional *bool + Enabled *bool + Identifier string + Issuer string + JwksURI *string + Name string + PKCEEnabled *bool + ProviderType string + Scopes []string + SkipNonceCheck *bool + TokenURL string + UserinfoURL string + type AdminListUsersResponse struct + Aud string + Users []*models.User + type AdminUserParams struct + AppMetaData map[string]interface{} + Aud string + BanDuration string + Email string + EmailConfirm bool + Id string + Password *string + PasswordHash string + Phone string + PhoneConfirm bool + Role string + UserMetaData map[string]interface{} + type AuthMicroserviceClaims struct + FunctionHooks FunctionHooks + InstanceID string + SiteURL string + type ChallengeFactorParams struct + Channel string + WebAuthn *WebAuthnParams + type ChallengeFactorResponse struct + ExpiresAt int64 + ID uuid.UUID + Type string + WebAuthn *WebAuthnChallengeData + type CreateSSOProviderParams struct + AttributeMapping models.SAMLAttributeMapping + Disabled *bool + Domains []string + MetadataURL string + MetadataXML string + NameIDFormat string + ResourceID *string + Type string + type EnrollFactorParams struct + FactorType string + FriendlyName string + Issuer string + Phone string + type EnrollFactorResponse struct + FriendlyName string + ID uuid.UUID + Phone string + TOTP *TOTPObject + Type string + type ErrorCause interface + Cause func() error + type FunctionHooks map[string][]string + func (f *FunctionHooks) UnmarshalJSON(b []byte) error + type GenerateLinkParams struct + Data map[string]interface{} + Email string + NewEmail string + Password string + RedirectTo string + Type string + type GenerateLinkResponse struct + ActionLink string + EmailOtp string + HashedToken string + RedirectTo string + VerificationType string + type HTTPError = apierrors.HTTPError + type HTTPErrorResponse20240101 struct + Code apierrors.ErrorCode + Message string + type HealthCheckResponse struct + Description string + Name string + Version string + type HealthResponse struct + Checks map[string]string + Error string + Service string + Status string + UptimeSeconds int64 + Version string + type IdTokenGrantParams struct + AccessToken string + ClientID string + IdToken string + Issuer string + LinkIdentity bool + Nonce string + Provider string + type InviteParams struct + Data map[string]interface{} + Email string + type JwksResponse struct + Keys []jwk.Key + type LimiterOptions struct + AnonymousSignIns *limiter.Limiter + Email ratelimit.Limiter + FactorChallenge *limiter.Limiter + FactorVerify *limiter.Limiter + MagicLink *limiter.Limiter + OAuthClientRegister *limiter.Limiter + Otp *limiter.Limiter + Phone ratelimit.Limiter + Recover *limiter.Limiter + Resend *limiter.Limiter + SAMLAssertion *limiter.Limiter + SSO *limiter.Limiter + Signups *limiter.Limiter + Token *limiter.Limiter + User *limiter.Limiter + Verify *limiter.Limiter + Web3 *limiter.Limiter + func NewLimiterOptions(gc *conf.GlobalConfiguration) *LimiterOptions + type LogoutBehavior string + const LogoutGlobal + const LogoutLocal + const LogoutOthers + type MagicLinkParams struct + CodeChallenge string + CodeChallengeMethod string + Data map[string]interface{} + Email string + func (p *MagicLinkParams) Validate(a *API) error + type OAuthError = apierrors.OAuthError + type OAuthProviderData struct + type OpenIDConfigurationResponse struct + AuthorizationEndpoint string + ClaimsSupported []string + CodeChallengeMethodsSupported []string + GrantTypesSupported []string + IDTokenSigningAlgValuesSupported []string + Issuer string + JWKSURL string + RegistrationEndpoint string + ResponseModesSupported []string + ResponseTypesSupported []string + ScopesSupported []string + SubjectTypesSupported []string + TokenEndpoint string + TokenEndpointAuthMethodsSupported []string + UserInfoEndpoint string + type Option interface + func WithMailer(m mailer.Mailer) Option + func WithTokenService(service *tokens.Service) Option + type OtpParams struct + Channel string + CodeChallenge string + CodeChallengeMethod string + CreateUser bool + Data map[string]interface{} + Email string + Phone string + func (p *OtpParams) Validate() error + type PKCEGrantParams struct + AuthCode string + CodeVerifier string + type PasskeyMetadataResponse struct + BackedUp bool + BackupEligible bool + CreatedAt time.Time + FriendlyName string + ID string + Transports []protocol.AuthenticatorTransport + type PasskeyRegistrationOptionsParams struct + type PasskeyRegistrationOptionsResponse struct + ChallengeID string + ExpiresAt int64 + Options *protocol.CredentialCreation + type PasskeyRegistrationVerifyParams struct + ChallengeID string + CredentialResponse json.RawMessage + type PasswordGrantParams struct + Email string + Password string + Phone string + type ProviderSettings struct + AnonymousUsers bool + Apple bool + Azure bool + Bitbucket bool + Discord bool + Email bool + Facebook bool + Figma bool + Fly bool + GitHub bool + GitLab bool + Google bool + Kakao bool + Keycloak bool + Linkedin bool + LinkedinOIDC bool + Notion bool + Phone bool + Slack bool + SlackOIDC bool + Snapchat bool + Spotify bool + Twitch bool + Twitter bool + WorkOS bool + Zoom bool + type RecoverParams struct + CodeChallenge string + CodeChallengeMethod string + Email string + func (p *RecoverParams) Validate(a *API) error + type RefreshTokenGrantParams struct + RefreshToken string + func (p *RefreshTokenGrantParams) Validate() error + type RequestParams interface + type ResendConfirmationParams struct + Email string + Phone string + Type string + func (p *ResendConfirmationParams) Validate(a *API) error + type SAMLAssertion struct + func (a *SAMLAssertion) Attribute(name string) []saml.AttributeValue + func (a *SAMLAssertion) Email() string + func (a *SAMLAssertion) NotAfter() time.Time + func (a *SAMLAssertion) NotBefore() time.Time + func (a *SAMLAssertion) Process(mapping models.SAMLAttributeMapping) map[string]interface{} + func (a *SAMLAssertion) SubjectID() (string, bool) + func (a *SAMLAssertion) UserID() string + type Settings struct + DisableSignup bool + ExternalProviders ProviderSettings + MailerAutoconfirm bool + PasskeysEnabled bool + PhoneAutoconfirm bool + SAMLEnabled bool + SmsProvider string + type SignupParams struct + Aud string + Channel string + CodeChallenge string + CodeChallengeMethod string + Data map[string]interface{} + Email string + Password string + Phone string + Provider string + func (p *SignupParams) ConfigureDefaults() + func (params *SignupParams) ToUserModel(isSSOUser bool) (user *models.User, err error) + type SingleSignOnParams struct + CodeChallenge string + CodeChallengeMethod string + Domain string + ProviderID uuid.UUID + RedirectTo string + SkipHTTPRedirect *bool + type SingleSignOnResponse struct + URL string + type SmsOtpResponse struct + MessageID string + type SmsParams struct + Channel string + CodeChallenge string + CodeChallengeMethod string + Data map[string]interface{} + Phone string + func (p *SmsParams) Validate(config *conf.GlobalConfiguration) error + type TOTPObject struct + QRCode string + Secret string + URI string + type UnenrollFactorResponse struct + ID uuid.UUID + type UserUpdateParams struct + AppData map[string]interface{} + Channel string + CodeChallenge string + CodeChallengeMethod string + CurrentPassword *string + Data map[string]interface{} + Email string + Nonce string + Password *string + Phone string + type VerifyFactorParams struct + ChallengeID uuid.UUID + Code string + WebAuthn *WebAuthnParams + type VerifyParams struct + Email string + Phone string + RedirectTo string + Token string + TokenHash string + Type string + func (p *VerifyParams) Validate(r *http.Request, a *API) error + type WeakPasswordError struct + Message string + Reasons []string + func (e *WeakPasswordError) Error() string + type Web3GrantParams struct + Chain string + Message string + Signature string + type WebAuthnChallengeData struct + CredentialOptions interface{} + Type string + type WebAuthnParams struct + CredentialResponse json.RawMessage + RPID string + RPOrigins []string + Type string + func (w *WebAuthnParams) ToConfig() (*webauthn.WebAuthn, error)