OTP

Endpoints to create and activate a one time code

Login with OTP

Send a login email or SMS to the user. The user will receive an email or text with a one-time passcode to complete their login.

POSThttps://auth.passage.id/v1/apps/{app_id}/login/otp
Path parameters
app_id*string

App ID

Body

User Data

identifier*string

valid email or E164 phone number

languagestring

language of the email to send (optional)

Response

OK

Body
otp_id*string

The ID of the one-time passcode. Provide it when activating.

Request
const response = await fetch('https://auth.passage.id/v1/apps/{app_id}/login/otp', {
    method: 'POST',
    headers: {
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      "identifier": "text"
    }),
});
const data = await response.json();
Response
{
  "otp_id": "text"
}

Register with OTP

Create a user and send a registration email or SMS to the user. The user will receive an email or text with a one-time passcode to complete their registration.

POSThttps://auth.passage.id/v1/apps/{app_id}/register/otp
Path parameters
app_id*string

App ID

Body

User Data

identifier*string

valid email or E164 phone number

languagestring

language of the email to send (optional)

Response

Created

Body
otp_id*string

The ID of the one-time passcode. Provide it when activating.

Request
const response = await fetch('https://auth.passage.id/v1/apps/{app_id}/register/otp', {
    method: 'POST',
    headers: {
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      "identifier": "text"
    }),
});
const data = await response.json();
Response
{
  "otp_id": "text"
}

Authenticate OTP

Authenticate a one-time passcode for a user. This endpoint checks that the one-time passcode is valid, then returns an authentication token for the user.

POSThttps://auth.passage.id/v1/apps/{app_id}/otp/activate
Path parameters
app_id*string

App ID

Body

User Data

otp*string
otp_id*string

The ID of the one-time passcode.

Response

OK

Body
auth_result*AuthResult (object)
Request
const response = await fetch('https://auth.passage.id/v1/apps/{app_id}/otp/activate', {
    method: 'POST',
    headers: {
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      "otp": "text",
      "otp_id": "text"
    }),
});
const data = await response.json();
Response
{
  "auth_result": {
    "auth_token": "text",
    "redirect_url": "text",
    "refresh_token": "text"
  }
}

Last updated

Change request #337: react native