> For the complete documentation index, see [llms.txt](https://docs.bond.network/developers/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.bond.network/developers/bond-sdk/bond-js-sdk/authenticate.md).

# Authenticate

Example of how to use Bond JS SDK to authenticate.

{% tabs %}
{% tab title="Typscript" %}

```typescript
import BondHub, { Blockchain, Env } from "@bondlab/client";
import Web3 from "web3";

const apiKey = process.env.BOND_API_KEY;
const appId = process.env.BOND_APP_ID;

const bondHub = new BondHub({
  provider: Web3.givenProvider,
  chain: Blockchain.POLYGON,
  env: Env.STAGING,
  apiKey,
  appId,
})

// get challenge and autheniticate with the signature
await bondHub.login()
```

{% endtab %}
{% endtabs %}

Or you can authenticate via seperate steps.

{% tabs %}
{% tab title="Typescript" %}

```typescript
import BondHub, { Blockchain, Env } from "@bondlab/client";

const apiKey = process.env.BOND_API_KEY;
const appId = process.env.BOND_APP_ID;
const privateKey = process.env.WALLET_PRIVATE_KEY

const bondHub = new BondHub({
  provider: Web3.givenProvider,
  chain: Blockchain.POLYGON,
  env: Env.STAGING,
  apiKey,
  appId,
}


const wallet = new ethers.Wallet(privateKey);
const address = await wallet.getAddress();

const challenge = await bondHub.generateChallenge(address);
const signature = await wallet.signMessage(challenge);

await bondHub.authenticate(address, signature);

```

{% endtab %}
{% endtabs %}
