Quick Exchange
  • Quick Exchange for Partners
  • Expired Quote Handling
  • Widget Integration
    • Embedded Widget
    • Configuration
      • Config Version
      • Settlement Defaults
      • Settlement Parameters
      • Custom Styles
      • Identity
      • Special Layout
      • Partner Fields
    • Event Hooks
  • API Integration
    • Authentication
    • User Session
      • OAuth
      • KYC
    • Settlements
  • Settlements
    • Funding Methods
      • BLOCKCHAIN_TRANSFER
      • BLOCKCHAIN_DELEGATED_BROADCAST
      • CARD_PAYMENT
        • Test Cards
    • Payout Methods
      • BLOCKCHAIN_TRANSFER
      • LIQUID_PARTNER_WALLET
      • LIQUID_WALLET
      • LIQUID_USER_WALLET
  • E-Commerce
    • X-Quoine-Auth
    • Intents (Fixed Settlements)
      • Deliverable Currency
    • Transactions
      • Transaction Status
Powered by GitBook
On this page
  • Create User API Token
  • Encode and Sign JWT
  • Example

Was this helpful?

  1. E-Commerce

X-Quoine-Auth

PreviousLIQUID_USER_WALLETNextIntents (Fixed Settlements)

Last updated 3 years ago

Was this helpful?

Create User API Token

A user API token must be created to be able to use this endpoint. This user must be the configured user for the partner api key. Refer to help article on creating tokens:

This token only requires the view Accounts View permission.

Creating an API token in the Liquid web app provides two variables: tokenId and tokenSecret.

Encode and Sign JWT

After creating the API toke/secret above, the next step is to create a signed JWT.

To generate X-Quoine-Auth (signed JWT string), encode and sign the following payload:

{
    "token_id": "{created in Liquid web app, link above}",
    "path": "/realtime",
    "delegate_path": {path of api request},
    "nonce": {current unix timestamp}
}

Example

/**
npm install jwt-simple
npm install axios
node example.js
*/


const jwt = require("jwt-simple");
const axios = require("axios");

const tokenId = "";
const tokenSecret =  "";
const publicApiKey = "pk_xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
const path = `/api/v1/partner/${publicApiKey}/transactions`;

const apiBase = "https://partners.liquid.com";

const xQuoineAuth = jwt.encode(
  {
    token_id: tokenId,
    path: "/realtime",
    delegate_path: path,
    nonce: Date.now(),
  },
  tokenSecret
);

console.log("Single use auth header: ",  {
  "X-Quoine-Auth": xQuoineAuth
})
https://help.liquid.com/en/articles/2285018-how-to-create-api-tokens