Embedded Wallets
SDK
Javascript
How to
Setup Authentication
Email
Verify Login

Verify Login

This method allows you to verify and complete the login process for your Xellar Embedded wallet account using the OTP sent to the user's email.

Parameters

  • verificationToken (string, required): The verification token received from the login method.
  • otp (string, required): The OTP sent to the user's email.
  • options (object, optional): Configuration object.
    • rampable (object, optional): Rampable account configuration.
      • username (string): The username for the rampable account.
      • fullName (string): The full name for the rampable account.
      • password (string): The password for the rampable account.

Returns

An AuthSuccessResponse object, potentially including a rampableAccessToken if the rampable option was provided.

If a wallet is created, the response will include a walletToken.

{
  "refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "isWalletCreated": true,
  "walletToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
}

If a wallet is not created, the response will include an accessToken.

{
  "refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "isWalletCreated": false,
  "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}

If the rampable option was provided, the response will include a rampableAccessToken.

{
  "isWalletCreated": false,
  "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "rampableAccessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}

Example Usage

Basic usage

const verificationToken = "verificationToken";
const otp = "otp";
const response = await sdk.auth.email.verify(verificationToken, otp);

With rampable option

const verificationToken = "verificationToken";
const otp = "otp";
const options = {
  rampable: {
    username: "username",
    fullName: "fullName",
    password: "password"
  }
};
 
const response = await sdk.auth.email.verify(verificationToken, otp, options);