widget_origin_refused: This origin may not call the widget routes

A browser on another website called a widget data route. The widget routes answer the deployment's own origin and the exact origins the operator lists in CORE_WIDGET_ORIGINS; every other Origin is refused. The widget script itself (/widgets/v1/dynamo-widgets.js) is served to any origin.

What to do

On the wire

HTTP 403, error type authentication_error, always JSON. The body depends on who answers.

A single-tenant (self-hosted) core answers every widget request from a refused origin, including the browser's preflight (OPTIONS). Behind the multi-tenant front door, the account's core gives the same answer to a GET or POST from a refused origin once the front door has accepted the token:

{
  "error": "unauthorized",
  "errorDetail": {
    "type": "authentication_error",
    "code": "widget_origin_refused",
    "message": "this origin may not call the widget routes (fail closed)",
    "param": null,
    "doc_url": "…/developers/widgets.md#widget-origin-refused",
    "fix": "add the page's origin to CORE_WIDGET_ORIGINS, or serve the page from the core's origin"
  }
}

The multi-tenant hosted front door answers the browser's preflight (OPTIONS) itself:

{
  "error": "widget_origin_refused",
  "errorDetail": {
    "type": "authentication_error",
    "code": "widget_origin_refused",
    "message": "this origin may not call the widget routes (fail closed)",
    "param": null,
    "doc_url": "…/errors/widget_origin_refused.md",
    "fix": "serve the widget from the same origin, or ask the operator to add your origin to CORE_WIDGET_ORIGINS"
  }
}

On the hosted tier a missing, malformed or unknown token is answered by the front door's token codes before the origin is checked.

See all error codes.