ByCloud Docs
GuidesCLIAPISDK

Authentication

Configure authentication for the JavaScript SDK.

Using an Access Token

If you have an access token from the ByCloud console, you can use it directly:

import { ByCloud } from "@bycoded/bycloud-sdk";
// Using an access token
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});

Using API Key Credentials

For service accounts, use the access key ID and secret access key:

import { ByCloud } from "@bycoded/bycloud-sdk";
// Using API key credentials
const client = new ByCloud({
accessKeyId: "YOUR_ACCESS_KEY_ID",
secretAccessKey: "YOUR_SECRET_ACCESS_KEY",
});

Environment Variables

The SDK can automatically read credentials from environment variables. This is recommended for production deployments:

import { ByCloud } from "@bycoded/bycloud-sdk";
// The SDK automatically reads from environment variables:
// BYCLOUD_TOKEN or BYCLOUD_ACCESS_KEY_ID + BYCLOUD_SECRET_ACCESS_KEY
const client = new ByCloud();

Supported environment variables: BYCLOUD_TOKEN, BYCLOUD_ACCESS_KEY_ID, BYCLOUD_SECRET_ACCESS_KEY