End-user API (SDK)
Google sign-in, step 1: send the browser to Google
GET/v1/oauth/google/start
Base URL: https://eu.auth.foxlogin.app, https://tr.auth.foxlogin.app
Open this URL in the user's browser with a link or
location.assign, not with fetch. Fox Login checks the request
and answers 303 with a redirect to Google's account chooser.
Fox Login uses its own Google app, so users see "Fox Login" on
Google's screen and there is nothing to set up at Google. Using
your own Google app is planned.
Call the host of the application's region, which the publishable
key names: pk_live_eu_… → eu.auth.foxlogin.app. Google sign-in
must be on for the application (providers.google.enabled, on by
default), and redirect_uri must be one of its redirect_urls
(see PATCH /applications/{app_id}).
Google returns the browser to
https://<region>.auth.foxlogin.app/v1/oauth/google/callback, the
Return URL of Fox Login's Google app. You never call it and do not
enter it anywhere. Fox Login exchanges Google's code (with PKCE),
checks the ID token and sends the browser on to redirect_uri,
adding these query parameters after any query the URL already has:
| Parameters | When | Next step |
|---|---|---|
fox_code |
An existing user (linked before, or matched by email), or a new user created with the country you passed. |
POST /v1/client/oauth/token within 2 minutes |
fox_status=country_required, fox_ticket |
A new user, and the start URL had no country. |
Ask for the country, then POST /v1/client/oauth/complete within 15 minutes |
fox_error |
The sign-in did not finish. | Show a message and offer to try again |
Each comes with state when you sent one. fox_error is
access_denied (the user cancelled at Google), provider_error
(Google's answer could not be used), email_not_verified (Google
has not verified the account's email), account_locked (the
matching user is not active), country_not_allowed or
server_error. Treat any other value like provider_error.
A Google account signs in to the user it is linked to. A Google
account seen for the first time is linked to the user of this
application with the same email, which Google must have verified;
that records identity.linked and marks the user's email verified.
If there is no such user, a new one is created with
email_verified: true and the name from Google. Users belong to
one application, so the same Google account is a separate user in
each application.
Errors in this step are answered as JSON, not as a redirect,
because they mean the start URL itself is wrong. At most 30 starts
per minute per IP address (429 rate_limited). Each sign-in can
return once, within 10 minutes. A late or repeated return gets Fox
Login's own "This sign-in link has expired" page (400, HTML)
instead of a redirect, because there is no trusted place to send
the browser.
Query parameters
publishable_keystringrequiredThe application's publishable key. It goes in the URL because a browser navigation cannot send the
X-Fox-Publishable-Keyheader.Example:
pk_live_eu_Xk2m9wQe4Rt7Yu1Io0Pa3Sd6Fg8Hj5Kl2Zx4Cv7Bn1Mredirect_uristring (uri)requiredWhere the browser returns. Must equal one of the application's
redirect_urlsexactly.Example:
https://anka.io/auth/callbackstatestringYour own value, returned unchanged as
stateonredirect_uri. Use a random value kept in the browser session and compare it when the user returns. At most 512 characters.countrystringISO 3166-1 alpha-2 country for a new user, in any case. With it, a new user is created during the callback and you get
fox_codeat once; without it, a new user comes back withfox_status=country_required. It is checked against the country restriction at the start; existing users keep their country.Example:
TR
Responses
303
Redirect to Google.
400Bad RequestError
redirect_uri_not_allowed(add the URL to the application'sredirect_urlsfirst),invalid_state(longer than 512 characters) orinvalid_country.errorobjectrequired5 properties
codestringrequiredStable machine code, e.g. email_exists, country_not_allowed, user_moved, method_not_available, region_unavailable
Example:
region_unavailablemessagestringrequiredPlain English, for developers
regionstringnullableRegion that produced the error, if any
Values:
EUTRretryablebooleanrequireddetailsobject
401UnauthorizedError
invalid_publishable_key.errorobjectrequired5 properties
codestringrequiredStable machine code, e.g. email_exists, country_not_allowed, user_moved, method_not_available, region_unavailable
Example:
region_unavailablemessagestringrequiredPlain English, for developers
regionstringnullableRegion that produced the error, if any
Values:
EUTRretryablebooleanrequireddetailsobject
422Unprocessable ContentError
provider_disabled(Google sign-in is turned off for this application) orcountry_not_allowed.errorobjectrequired5 properties
codestringrequiredStable machine code, e.g. email_exists, country_not_allowed, user_moved, method_not_available, region_unavailable
Example:
region_unavailablemessagestringrequiredPlain English, for developers
regionstringnullableRegion that produced the error, if any
Values:
EUTRretryablebooleanrequireddetailsobject
429Too Many RequestsError
rate_limited. Retry afterRetry-Afterseconds.errorobjectrequired5 properties
codestringrequiredStable machine code, e.g. email_exists, country_not_allowed, user_moved, method_not_available, region_unavailable
Example:
region_unavailablemessagestringrequiredPlain English, for developers
regionstringnullableRegion that produced the error, if any
Values:
EUTRretryablebooleanrequireddetailsobject
503Service UnavailableError
provider_not_configured: Google sign-in is not set up in this region. Retry afterRetry-Afterseconds.errorobjectrequired5 properties
codestringrequiredStable machine code, e.g. email_exists, country_not_allowed, user_moved, method_not_available, region_unavailable
Example:
region_unavailablemessagestringrequiredPlain English, for developers
regionstringnullableRegion that produced the error, if any
Values:
EUTRretryablebooleanrequireddetailsobject
defaultDefaultError
Any other error, such as a
500, uses the same error envelope.errorobjectrequired5 properties
codestringrequiredStable machine code, e.g. email_exists, country_not_allowed, user_moved, method_not_available, region_unavailable
Example:
region_unavailablemessagestringrequiredPlain English, for developers
regionstringnullableRegion that produced the error, if any
Values:
EUTRretryablebooleanrequireddetailsobject