Mojito API Kit

⚙️ How to Install and Setup the Mojito Core-service SDK module.


The Mojito Core Service SDK provides convenient abstractions for interacting with the core-service APIs in a TypeScript/JavaScript environment. It simplifies integrating the SDK into your application by offering a range of APIs for the secondary marketplace, claim token, and auction functionalities.

This guide will help you better understand how to use and integrate the Core-service SDK into your application.



For more detailed information and examples, you can refer to the NPM Packages here.


Before proceeding with the installation steps, ensure that you have the following prerequisites in place:

  1. Node.js and NPM/Yarn: Make sure you have Node.js installed on your machine, along with either NPM (Node Package Manager) or Yarn. You can download and install Node.js from the official website here.
  2. Authentication Provider: To obtain the necessary token for authentication, you need to have an authentication provider set up. This can be a JWT (JSON Web Token) or an Auth0 token, which will be passed as the "token" property in the configuration.
  3. API URL: Determine the appropriate API URL to use based on your environment.

Installation and Setup

Step 1: Install the Core-service Module

Install the Mojito Core-service SDK module on your project by using one of the following methods below:

Install using NPM:

  npm i @mojito-inc/core-service

Install using Yarn:

  yarn add @mojito-inc/core-service

Install via package.json:

"@mojito-inc/core-service": "1.0.4"

Step 2: Wrap the Provider and Set API URL and Bearer Token

In your project's root file, follow these steps to wrap the provider and configure the API URL and Bearer token:

  1. Determine the appropriate API URL based on your environment:

    • For the development environment, set API_URL to
    • For the production environment, set API_URL to
  2. Obtain a JWT token or Auth0 token from your authentication provider.

    • This token will be passed as the "token" property in the provider configuration.
  3. Wrap the provider using the CoreServiceProvider component from the Mojito Core Service SDK.

    • Import the CoreServiceProvider from @mojitoinc/core-service in your JavaScript file.
    • Use the CoreServiceProvider component and provide the following props:
      • uri: Set this prop to the determined API_URL based on your environment.
      • token: Pass the obtained JWT token or Auth0 token as the value for this prop. Use the format Bearer <Token>.
import { CoreServiceProvider } from "@mojitoinc/core-service";

<CoreServiceProvider uri={API_URL } token={ 'Bearer <Token>' }>
  { children }

Step 3: Using the useUser Service and the updateUserOrgSettings API

To update user organization settings, follow these steps:

  1. Import the necessary modules and types from the @mojitoinc/mojito-core-service package:

    import { useUser, updateUserOrgSettingsData } from "@mojitoinc/mojito-core-service";
  2. Invoke the useUser service to access the updateUserOrgSettings function:

    const { updateUserOrgSettings } = useUser();
  3. Fill in the required parameters for the updateUserOrgSettings

  4. Call the updateUserOrgSettings API by providing the required parameters and awaiting its response:

    const response: Response<updateUserOrgSettingsData> = await updateUserOrgSettings({
      userOrgId: <USER_ORG_ID>,
      username: <USER_NAME>,
      avatar: <AVATAR>,
      settingsJson: <SETTING_JSON>,
      profilePic: <PROFILE_PIC>


Upon successfully calling the API, you will receive a response object with the following structure:

  "data": {
    "updateUserOrgSettings": {
      "id": "d1a59f7e-8626-46f9-b0ca-b70477910c8c",
      "username": "test",
      "avatar": "U0BpDFXLEKmMNPly"



For complete documentation of the Core-service SDK offerings, see the core-service.