# Auth0

Auth0 sends its MFA, enrollment and blocked-account SMS through our platform with a **custom phone provider** (an Action you paste as is). Auth0 makes and checks the code; we deliver it with your Verify app (sender, template, language and fraud protection) and it appears on your Verify page tagged `auth0`.

## Set up {#setup}

1. Portal › Developers › API keys: create a **live** key with limited access and only the `verify` permission.
2. Auth0 Dashboard › Branding › Phone Provider › **Custom**. In the Action editor paste the code below and add the secret `API_KEY` with your key.
3. Replace `app_…` with your Verify app id, deploy, and use **Send test message**.

## Responses {#responses}

`201` with the verification id. When we cannot send (premium number, new country over its limit, rate limits, balance…) we answer with the API error (`4xx`) and the Action throws it: Auth0 logs the failure.

The body of the older "Send Phone Message" Action (`event.message_options`) is accepted too.

```
exports.onExecuteCustomPhoneProvider = async (event, api) => {
  const res = await fetch("https://app.ogave.co/v1/verify/connectors/auth0?app_id=app_…", {
    method: "POST",
    headers: { "Authorization": `Bearer ${event.secrets.API_KEY}`, "Content-Type": "application/json" },
    body: JSON.stringify(event.notification),
  });
  if (!res.ok) {
    const body = await res.json().catch(() => ({}));
    throw new Error(body.error ? `${body.error.code}: ${body.error.message}` : `HTTP ${res.status}`);
  }
};
```
