v1 · OpenAPI 3.1Dashboard

Reference

Errors

Every 4xx and 5xx response from Fox Login uses one envelope:

{
  "error": {
    "code": "region_unavailable",
    "message": "The TR region is not available right now.",
    "region": "TR",
    "retryable": true,
    "details": {}
  }
}
Field Meaning
code Stable machine code. Match on it in your code.
message Plain English for developers. It can change; do not match on it or show it to end users as is.
region The region that produced the error, or null.
retryable true when the same request can succeed later.
details Extra data for some codes, such as user_id for email_exists.

429 and 503 responses carry a Retry-After header with the number of seconds to wait.

In the SDKs

Every failed call throws FoxLoginError with status, code, message, retryable, retryAfter (seconds, from Retry-After), region and details. Network failures throw it with status 0 and code network_error.

Browser
import { FoxLogin, FoxLoginError } from "foxlogin";

try {
  await fox.signIn({ email, password });
} catch (e) {
  if (!(e instanceof FoxLoginError)) throw e;
  if (e.code === "invalid_credentials") showError("Wrong email or password.");
  else if (e.code === "rate_limited") showError(`Too many attempts. Try again in ${e.retryAfter ?? 60} seconds.`);
  else if (e.retryable) retryLater(e.retryAfter ?? 30);
  else throw e;
}

Error codes

Code Status Meaning
invalid_body 400 The JSON body is missing, malformed or lacks a required field.
invalid_email 400 The email address is not valid.
weak_password 400 The password has fewer than 8 or more than 256 characters.
invalid_country 400 The country is not an ISO 3166-1 alpha-2 code.
invalid_code 400, 401 The emailed code is wrong, expired, or had 5 wrong attempts. Email-code sign-in returns it as 401. For Google sign-in, the fox_code or fox_ticket is wrong, used or expired.
invalid_mfa_code 400 The TOTP or recovery code is wrong.
invalid_name 400 An application name is not 1 to 100 characters, or a key name is longer than 60.
invalid_role 400 A secret key role is not admin, editor or viewer.
invalid_scope 400 The scopes list for a new organization key is empty or has an unknown scope.
invalid_webhook_url 400 The webhook URL is not https on a public hostname.
invalid_events 400 The webhook event list is empty or has an unknown type.
invalid_country_restriction 400 country_restriction.mode is not all or only_listed.
invalid_redirect_url 400 A redirect URL is not https (http only for localhost), has a user name, password, #, * or space, or is longer than 500 characters. The message names the URL.
too_many_redirect_urls 400 More than 20 redirect URLs.
redirect_uri_not_allowed 400 The redirect_uri of a Google sign-in is not one of the application's redirect URLs.
invalid_state 400 The state of a Google sign-in is longer than 512 characters.
invalid_credentials 401 The email or password is wrong, or the account is locked.
invalid_mfa_token 401 The two-factor challenge expired, was used, or had 5 wrong codes. Sign in again.
invalid_refresh_token 401 The refresh token is unknown, used or revoked. The SDK signs the user out.
invalid_publishable_key 401 The publishable key is unknown.
missing_api_key 401 A Management API call has no Bearer token.
invalid_api_key 401 The secret key or organization API key is unknown or revoked.
invalid_token 401 verifyToken rejected the token: bad signature, wrong issuer or algorithm, or expired.
wrong_application 401 verifyToken got a token of another application than applicationId.
missing_scope 403 The key's role or scopes, or the member's dashboard role, lack the scope the endpoint needs or a scope the caller tries to grant.
secret_key_not_allowed 403 A secret key called an endpoint for the whole organization. Use an organization API key.
account_locked 403 The user a Google account belongs to is not active.
not_found 404 The resource does not exist, or it belongs to an application the key cannot see.
email_exists 409 The email already belongs to a user of this application. details.user_id holds that user.
mfa_already_enabled 409 The user already has TOTP on.
country_not_allowed 422 The application accepts users only from listed countries.
region_immutable 422 An update tried to change the application's region.
provider_disabled 422 Google sign-in is turned off for the application.
webhook_limit 422 The application already has 10 webhook endpoints.
rate_limited 429 Too many requests. Wait Retry-After seconds.
region_unavailable 503 The user's region cannot answer right now. Retry after Retry-After seconds.
busy 503 Too many sign-ups at this moment. Retry shortly.
provider_not_configured 503 Google sign-in is not set up in this region. Retry after Retry-After seconds.

Problems that happen at Google do not come back as HTTP errors. Fox Login sends them to your redirect URL as a fox_error query parameter instead; Sign in with Google lists the values.

The API reference lists the errors of each endpoint.