Skip to main content

Authentication

To authenticate the client with the bArchive API, utilize the authenticate method from the SDK. This process is essential for establishing a secure connection with the edeXa services.


Sample Code Snippet

Here is a JavaScript code snippet demonstrating the use of the authenticate method:

import { Bstamp, Network } from 'edeXa-sdk';

async function authenticateClient() {
const bstamp = new Bstamp();
const settings = {
clientId: 'your_client_id',
clientSecret: 'your_client_secret',
network: Network.SANDBOX, // or Network.MAINNET for the mainnet network
};

try {
const authResponse = await bstamp.authenticate(settings);
// Handle Success
} catch (error) {
// Handle Error
}
}


Key Points to Note

  • Asynchronous Function: The authenticateClient function operates as an asynchronous (async) function, leveraging await to hold execution until the bstamp.authenticate promise completes.
  • Client Credentials: Substitute your_client_id and your_client_secret with the genuine client ID and client secret assigned to you. These credentials are available in the edeXa Developer Settings.

Request Parameters

ParameterRequiredTypeDescription
clientIdYesNumberEnter your clientId
clientSecretYesStringThe secret of the client

Response Format

KeyTypeDescription
idStringUnique identifier for the user
tokenStringAuthentication token
usernameStringUsername of the authenticated user
nameString