authentication

Sign in with magic link email

Changed on

Initiate passwordless authentication by sending a magic link to the user's email. If the user doesn't exist and AUTH_DISABLE_AUTO_SIGNUP is not set, a new account will be created with the provided options. When AUTH_DISABLE_AUTO_SIGNUP is enabled, users must use the /signup/passwordless/email endpoint to register first.

post/signin/passwordless/email

Request

  • Base URL
    https://{subdomain}.auth.{region}.nhost.run/v1
  • URL
    https://{subdomain}.auth.{region}.nhost.run/v1/signin/passwordless/email
  • Auth
    none declared

Request body

emailstring email required

A valid email

codeChallengestring

PKCE code challenge (S256). When provided, the verification redirect will contain an authorization code instead of a refresh token.

Example request

{
  "email": "john.smith@nhost.io",
  "options": {
    "allowedRoles": [
      "me",
      "user"
    ],
    "defaultRole": "user",
    "displayName": "John Smith",
    "locale": "en",
    "metadata": {
      "firstName": "John",
      "lastName": "Smith"
    },
    "redirectTo": "https://my-app.com/catch-redirection"
  }
}

Response

Magic link sent to the user's email. To prevent account enumeration, this response is also returned without side effects when the email is not registered and AUTH_DISABLE_AUTO_SIGNUP is enabled.

'OK' required

Changes

    • warning

      added the new otp-too-many-attempts enum value to the response property for the response status

    • warning

      added the new user-already-exists enum value to the response property for the response status

    • info

      removed the email-already-in-use enum value from the response property for the response status