Skip to main content

Authentication

To use Anvil tools you need to authenticate your SDK instance with a valid server API key.

The SDK uses a singleton to manage the authentication state, which means you only need to call the authenticate function once at the start of your program.

Warning

Beware that the authenticate function will throw an error if you pass an invalid API key.

Example

import { anvil } from "@ada-anvil/sdk-server";

try {
anvil.config.authenticate("server_XXXXXXX");
} catch {
console.log("Authentication failed");
}