Docs / Errors

ORIGIN_NOT_ALLOWED

403Origin not allowed

Why it happens

A browser called the API with a publishable key from a site the key does not list. The browser sends the page's origin with the call; the API serves a publishable key only to the origins in its Allowed origins:

  • the site is not in the key's list (https://example.org and https://www.example.org are two origins);
  • the key has no origins: it is an app key, and every browser call with it is refused;
  • you are developing locally, and http://localhost is not in the list.

The call does not count against the key's rate limit.

What to do

  • In the console, open the project's keys and choose Edit origins on the key. Add the site's origin, such as https://www.example.org, or http://localhost for development (it covers every port).
  • The API applies a change within a few minutes.
  • A call from another site with your key is refused on purpose: leave its origin out.

Example response

http
HTTP/1.1 403
{
  "type": "https://hub.masjidbox.com/docs/errors/ORIGIN_NOT_ALLOWED",
  "title": "Origin not allowed",
  "status": 403,
  "detail": "A browser call from an origin the publishable key does not list. Add the site's origin to the key in the console; a key with no origins is an app key, refused in every browser.",
  "instance": "/v1/masjids/msj_abc123defg",
  "code": "ORIGIN_NOT_ALLOWED",
  "requestId": "req_8f14e45fceea167a5a36dedd4bea2543",
  "requestLogUrl": "https://hub.masjidbox.com/console/logs/req_8f14e45fceea167a5a36dedd4bea2543"
}