auth

Verify OTP code

Verifies the OTP code and returns a session token and user. Public endpoint.

POST/api/auth/otp/verify

Authentication

Public — No Auth Required

Request Body

Identifier (phone/email), OTP code, and project ID.

json
{
  "identifier": "protocol copy",
  "otp": "microchip connect",
  "projectId": "proj_qh5hFHNT70YZ"
}
{
  "identifier": "protocol copy",
  "otp": "microchip connect",
  "projectId": "proj_qh5hFHNT70YZ"
}

SDK setup

Create a client instance. No authentication is required for this endpoint.

import { MudbaseClient } from "mudbase";

const client = new MudbaseClient();
import { MudbaseClient } from "mudbase";

const client = new MudbaseClient();

Example request

Call this endpoint using the client from SDK setup. Use View HTTP for a raw cURL example.

const result = await client.auth.verifyOtp({
  otp: "firewall back up",
  projectId: "proj_Zm2lVvPbpvbz",
  identifier: "bandwidth transmit"
});
const result = await client.auth.verifyOtp({
  otp: "firewall back up",
  projectId: "proj_Zm2lVvPbpvbz",
  identifier: "bandwidth transmit"
});

Try It Live

Test this endpoint with your own credentials. Your requests will be sent to the live API.

No Request Yet

Send a request to see the full inspector

Responses

200OTP verified
json
{
  "message": "OTP verified successfully",
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "expiresIn": 1800,
  "user": {
    "_id": "685acbe0e129932fbb7a0fc2",
    "email": "user@example.com",
    "firstName": "John",
    "lastName": "Doe"
  }
}
{
  "message": "OTP verified successfully",
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "expiresIn": 1800,
  "user": {
    "_id": "685acbe0e129932fbb7a0fc2",
    "email": "user@example.com",
    "firstName": "John",
    "lastName": "Doe"
  }
}
400Bad request or validation error.
401Authentication required or invalid token.
403Access denied or insufficient permissions.

Errors

CodeMeaning
400Bad request or validation error.
401Authentication required or invalid token.
403Access denied or insufficient permissions.
Edit this page on GitHub