Embedded Wallets
How to
Authorize

OAuth Google Authorize

OAuth Google Authorize API

Overview

This API endpoint allows you to login to your Xellar Embedded wallet account using google account.

  • HTTP Method: POST
  • Endpoint v2: /api/<VERSION>/auth/google

Request Body Parameters

  • credential (required): Credential token from google login.
  • expireDate (optional): The expiration date for the JWT token generated from the response.

Example Request Body

{
    "credential": "eyJraWQiOiJXNldjT0tCIiwiYWxnIjoiUlMyNTYi...",
    "expireDate": "2024-01-02"
}

Request

Request Headers

  • x-client-secret (required): Client secret which was generated when register in Xellar Embedded API Service Dashboard.

Example Request Syntax

cURL

curl -X POST -H "Content-Type: application/json" -H "x-client-secret: $YOUR_CLIENT_SECRET" -d '{ 
    "credential": "eyJraWQiOiJXNldjT0tCIiwiYWxnIjoiUlMyNTYi...",
    "expireDate": "2024-10-02"
}' <BASE_URL>/api/<VERSION>/auth/google

Response

The response will include a JSON object with the following properties:

  • status (number): The HTTP status code of the response (e.g., 200 for success).
  • message (string): A message providing additional information about the operation.
  • data (object): An object containing the accessToken and isWalletCreated. If the account already has an embedded wallet, the response will include walletToken and isWalletCreated.

Example Response (if account do not have an Embedded wallet)

{
    "status": 200,
    "message": "ok",
    "data": {
        "accessToken": "eyy9afadeasf31....",
        "isWalletCreated": false
    }
}

Example Response (if account already have an Embedded wallet)

{
    "status": 200,
    "message": "ok",
    "data": {
        "walletToken": "eyy9afadeasf31....",
        "isWalletCreated": true
    }
}

Example Response (if account already have an Embedded wallet in v2)

📝

This response only works on v2

{
    "status": 200,
    "message": "ok",
    "data": {
        "walletToken": "eyy9afadeasf31....",
        "refreshToken": "eysfsfsffssf1....",
        "isWalletCreated": true
    }
}