Module: BetterAuth
- Defined in:
- lib/better_auth.rb,
lib/better_auth/api.rb,
lib/better_auth/env.rb,
lib/better_auth/auth.rb,
lib/better_auth/core.rb,
lib/better_auth/host.rb,
lib/better_auth/async.rb,
lib/better_auth/error.rb,
lib/better_auth/crypto.rb,
lib/better_auth/doctor.rb,
lib/better_auth/logger.rb,
lib/better_auth/oauth2.rb,
lib/better_auth/plugin.rb,
lib/better_auth/router.rb,
lib/better_auth/schema.rb,
lib/better_auth/context.rb,
lib/better_auth/cookies.rb,
lib/better_auth/plugins.rb,
lib/better_auth/session.rb,
lib/better_auth/version.rb,
lib/better_auth/endpoint.rb,
lib/better_auth/password.rb,
lib/better_auth/response.rb,
lib/better_auth/api_error.rb,
lib/better_auth/deprecate.rb,
lib/better_auth/routes/ok.rb,
lib/better_auth/crypto/jwe.rb,
lib/better_auth/request_ip.rb,
lib/better_auth/schema/sql.rb,
lib/better_auth/http_client.rb,
lib/better_auth/oauth_state.rb,
lib/better_auth/plugins/dub.rb,
lib/better_auth/plugins/jwt.rb,
lib/better_auth/plugins/sso.rb,
lib/better_auth/routes/user.rb,
lib/better_auth/url_helpers.rb,
lib/better_auth/adapters/sql.rb,
lib/better_auth/plugins/expo.rb,
lib/better_auth/plugins/i18n.rb,
lib/better_auth/plugins/scim.rb,
lib/better_auth/plugins/siwe.rb,
lib/better_auth/rate_limiter.rb,
lib/better_auth/routes/error.rb,
lib/better_auth/adapters/base.rb,
lib/better_auth/configuration.rb,
lib/better_auth/plugin_loader.rb,
lib/better_auth/plugins/admin.rb,
lib/better_auth/request_state.rb,
lib/better_auth/routes/social.rb,
lib/better_auth/secret_config.rb,
lib/better_auth/session_store.rb,
lib/better_auth/sql_migration.rb,
lib/better_auth/adapters/mssql.rb,
lib/better_auth/adapters/mysql.rb,
lib/better_auth/database_hooks.rb,
lib/better_auth/migration_plan.rb,
lib/better_auth/plugin_context.rb,
lib/better_auth/plugins/access.rb,
lib/better_auth/plugins/bearer.rb,
lib/better_auth/plugins/stripe.rb,
lib/better_auth/routes/account.rb,
lib/better_auth/routes/session.rb,
lib/better_auth/routes/sign_in.rb,
lib/better_auth/routes/sign_up.rb,
lib/better_auth/adapters/memory.rb,
lib/better_auth/adapters/sqlite.rb,
lib/better_auth/instrumentation.rb,
lib/better_auth/plugin_registry.rb,
lib/better_auth/plugins/api_key.rb,
lib/better_auth/plugins/captcha.rb,
lib/better_auth/plugins/one_tap.rb,
lib/better_auth/plugins/passkey.rb,
lib/better_auth/routes/password.rb,
lib/better_auth/routes/sign_out.rb,
lib/better_auth/plugins/open_api.rb,
lib/better_auth/plugins/username.rb,
lib/better_auth/adapters/postgres.rb,
lib/better_auth/plugins/anonymous.rb,
lib/better_auth/plugins/email_otp.rb,
lib/better_auth/routes/validation.rb,
lib/better_auth/plugins/magic_link.rb,
lib/better_auth/plugins/two_factor.rb,
lib/better_auth/plugins/oauth_popup.rb,
lib/better_auth/plugins/oauth_proxy.rb,
lib/better_auth/social_providers/vk.rb,
lib/better_auth/plugins/admin/schema.rb,
lib/better_auth/plugins/organization.rb,
lib/better_auth/plugins/phone_number.rb,
lib/better_auth/adapters/join_support.rb,
lib/better_auth/plugins/generic_oauth.rb,
lib/better_auth/plugins/multi_session.rb,
lib/better_auth/social_providers/base.rb,
lib/better_auth/social_providers/kick.rb,
lib/better_auth/social_providers/line.rb,
lib/better_auth/social_providers/zoom.rb,
lib/better_auth/plugins/custom_session.rb,
lib/better_auth/plugins/oauth_protocol.rb,
lib/better_auth/plugins/oauth_provider.rb,
lib/better_auth/plugins/one_time_token.rb,
lib/better_auth/social_providers/apple.rb,
lib/better_auth/social_providers/figma.rb,
lib/better_auth/social_providers/kakao.rb,
lib/better_auth/social_providers/naver.rb,
lib/better_auth/social_providers/polar.rb,
lib/better_auth/social_providers/slack.rb,
lib/better_auth/middleware/origin_check.rb,
lib/better_auth/social_providers/github.rb,
lib/better_auth/social_providers/gitlab.rb,
lib/better_auth/social_providers/google.rb,
lib/better_auth/social_providers/linear.rb,
lib/better_auth/social_providers/notion.rb,
lib/better_auth/social_providers/paybin.rb,
lib/better_auth/social_providers/paypal.rb,
lib/better_auth/social_providers/reddit.rb,
lib/better_auth/social_providers/roblox.rb,
lib/better_auth/social_providers/tiktok.rb,
lib/better_auth/social_providers/twitch.rb,
lib/better_auth/social_providers/vercel.rb,
lib/better_auth/social_providers/wechat.rb,
lib/better_auth/social_providers/cognito.rb,
lib/better_auth/social_providers/discord.rb,
lib/better_auth/social_providers/dropbox.rb,
lib/better_auth/social_providers/railway.rb,
lib/better_auth/social_providers/spotify.rb,
lib/better_auth/social_providers/twitter.rb,
lib/better_auth/adapters/internal_adapter.rb,
lib/better_auth/plugins/additional_fields.rb,
lib/better_auth/plugins/have_i_been_pwned.rb,
lib/better_auth/plugins/last_login_method.rb,
lib/better_auth/routes/email_verification.rb,
lib/better_auth/social_providers/facebook.rb,
lib/better_auth/social_providers/linkedin.rb,
lib/better_auth/social_providers/atlassian.rb,
lib/better_auth/plugins/organization/schema.rb,
lib/better_auth/social_providers/salesforce.rb,
lib/better_auth/plugins/device_authorization.rb,
lib/better_auth/social_providers/huggingface.rb,
lib/better_auth/social_providers/microsoft_entra_id.rb
Defined Under Namespace
Modules: Adapters, Async, Cookies, Core, Crypto, Deprecate, Doctor, Env, HTTPClient, Host, Instrumentation, Logger, Middleware, MigrationPlan, OAuth2, OAuthState, OpenAPI, Password, Plugins, RequestIP, RequestState, Routes, SQLMigration, Schema, Session, SocialProviders, URLHelpers
Classes: API, APIError, Auth, Configuration, Context, DatabaseHooks, Endpoint, Error, Plugin, PluginContext, PluginRegistry, RateLimiter, Response, Router, SecretConfig, SessionStore
Constant Summary
collapse
- BASE_ERROR_CODES =
{
"USER_NOT_FOUND" => "User not found",
"FAILED_TO_CREATE_USER" => "Failed to create user",
"FAILED_TO_CREATE_SESSION" => "Failed to create session",
"FAILED_TO_UPDATE_USER" => "Failed to update user",
"FAILED_TO_GET_SESSION" => "Failed to get session",
"INVALID_PASSWORD" => "Invalid password",
"INVALID_EMAIL" => "Invalid email",
"INVALID_EMAIL_OR_PASSWORD" => "Invalid email or password",
"SOCIAL_ACCOUNT_ALREADY_LINKED" => "Social account already linked",
"PROVIDER_NOT_FOUND" => "Provider not found",
"INVALID_TOKEN" => "Invalid token",
"TOKEN_EXPIRED" => "Token expired",
"TOKEN_ALREADY_USED" => "Token has already been used",
"ID_TOKEN_NOT_SUPPORTED" => "id_token not supported",
"FAILED_TO_GET_USER_INFO" => "Failed to get user info",
"USER_EMAIL_NOT_FOUND" => "User email not found",
"EMAIL_NOT_VERIFIED" => "Email not verified",
"PASSWORD_TOO_SHORT" => "Password too short",
"PASSWORD_TOO_LONG" => "Password too long",
"USER_ALREADY_EXISTS" => "User already exists.",
"USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL" => "User already exists. Use another email.",
"EMAIL_CAN_NOT_BE_UPDATED" => "Email can not be updated",
"CREDENTIAL_ACCOUNT_NOT_FOUND" => "Credential account not found",
"SESSION_EXPIRED" => "Session expired. Re-authenticate to perform this action.",
"FAILED_TO_UNLINK_LAST_ACCOUNT" => "You can't unlink your last account",
"ACCOUNT_NOT_FOUND" => "Account not found",
"USER_ALREADY_HAS_PASSWORD" => "User already has a password. Provide that to delete the account.",
"CROSS_SITE_NAVIGATION_LOGIN_BLOCKED" => "Cross-site navigation login blocked. This request appears to be a CSRF attack.",
"VERIFICATION_EMAIL_NOT_ENABLED" => "Verification email isn't enabled",
"EMAIL_ALREADY_VERIFIED" => "Email is already verified",
"EMAIL_MISMATCH" => "Email mismatch",
"SESSION_NOT_FRESH" => "Session is not fresh",
"LINKED_ACCOUNT_ALREADY_EXISTS" => "Linked account already exists",
"INVALID_ORIGIN" => "Invalid origin",
"INVALID_CALLBACK_URL" => "Invalid callbackURL",
"INVALID_REDIRECT_URL" => "Invalid redirectURL",
"INVALID_ERROR_CALLBACK_URL" => "Invalid errorCallbackURL",
"INVALID_NEW_USER_CALLBACK_URL" => "Invalid newUserCallbackURL",
"MISSING_OR_NULL_ORIGIN" => "Missing or null Origin",
"CALLBACK_URL_REQUIRED" => "callbackURL is required",
"FAILED_TO_CREATE_VERIFICATION" => "Unable to create verification",
"FIELD_NOT_ALLOWED" => "Field not allowed to be set",
"ASYNC_VALIDATION_NOT_SUPPORTED" => "Async validation is not supported",
"VALIDATION_ERROR" => "Validation Error",
"MISSING_FIELD" => "Field is required",
"BODY_MUST_BE_AN_OBJECT" => "Body must be an object",
"METHOD_NOT_ALLOWED_DEFER_SESSION_REQUIRED" => "POST method requires deferSessionRefresh to be enabled in session config",
"PASSWORD_ALREADY_SET" => "User already has a password set",
"RESET_PASSWORD_DISABLED" => "Reset password isn't enabled",
"EMAIL_PASSWORD_DISABLED" => "Email and password is not enabled",
"EMAIL_PASSWORD_SIGN_UP_DISABLED" => "Email and password sign up is not enabled",
"CHANGE_EMAIL_DISABLED" => "Change email is disabled"
}.freeze
- VERSION =
"0.11.0"
Class Method Summary
collapse
Class Method Details
.auth(options = {}) ⇒ Object
68
69
70
|
# File 'lib/better_auth.rb', line 68
def self.auth(options = {})
Auth.new(options)
end
|
.const_missing(name) ⇒ Object
72
73
74
75
76
77
78
79
|
# File 'lib/better_auth.rb', line 72
def self.const_missing(name)
if name == :OpenAPI
Plugins.load_plugin!(:open_api)
return const_get(:OpenAPI) if const_defined?(:OpenAPI, false)
end
super
end
|