AuthЗапросить magic-link

Запросить magic-link

Отправляет magic-link на email через Cloudflare Email binding. Войти смогут: существующие пользователи и приглашённые (у кого есть pending invitation) — better-auth hook блокирует регистрацию без приглашения. После клика по ссылке пользователь редиректится на фронтенд (FRONTEND_URL): существующий — /dashboard, новый — /welcome, ошибка — /login. Абсолютные URL, т.к. фронт на другом домене.

curl -X POST "https://policy-engine-rest.ezig.workers.dev/api/v1/auth/magic-link" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -d '{
  "email": "user@example.com"
}'
{
  "status": true
}
POST
/api/v1/auth/magic-link
POST
Base URLstring

Target server for requests. Edit to use your own host.

Bearer Token
Bearer Tokenstring
Required

better-auth session token. Мобилка/сервисы. Веб использует cookie.

better-auth session token. Мобилка/сервисы. Веб использует cookie.
API Key (cookie: better-auth.session_token)
Content-Typestring
Required

The media type of the request body

Options: application/json
emailstring
Required
Format: email • Pattern: ^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$
Request Preview
Response

Response will appear here after sending the request

Authentication

header
Authorizationstring
Required

Bearer token. better-auth session token. Мобилка/сервисы. Веб использует cookie.

path
parameterstring
Required

API Key for authentication. Provide your API key in the cookie.

Body

application/json
emailstring
Required
Example:
user@example.com

Responses

statusboolean
Required