> For the complete documentation index, see [llms.txt](https://tutorial.neoline.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tutorial.neoline.io/reference/neo3-provider-api/authenticate.md).

# authenticate

Requests authentication using the NEP-20 authentication challenge payload.

## Parameters

#### 1. payload *(required)*

`AuthenticationChallengePayload`

```ts
type AuthenticationChallengePayload = {
  action: "Authentication";
  grant_type: "Signature";
  allowed_algorithms: ["ECDSA-P256"];
  domain: string;
  networks: Network[];
  nonce: string;
  timestamp: number;
};
```

## Returns

`Promise<AuthenticationResponsePayload>`

```ts
type AuthenticationResponsePayload = {
  algorithm: "ECDSA-P256";
  network: Network;
  pubkey: ECPoint;
  address: Address;
  nonce: string;
  timestamp: number;
  signature: Base64Encoded;
};
```

## Errors

| Code    | Name          | Description                                    |
| ------- | ------------- | ---------------------------------------------- |
| `10001` | `UNSUPPORTED` | Authentication is not supported by the wallet. |
| `10002` | `INVALID`     | The challenge payload is invalid.              |
| `10005` | `TIMEOUT`     | The authentication request timed out.          |
| `10006` | `CANCELED`    | The user rejected the authentication request.  |

## Example

### Request

```js
const response = await provider.authenticate({
  action: "Authentication",
  grant_type: "Signature",
  allowed_algorithms: ["ECDSA-P256"],
  domain: "example.com",
  networks: [860833102],
  nonce: "13458238842203010919",
  timestamp: 1616131368,
});
```

### Response

```js
{
  algorithm: "ECDSA-P256",
  network: 860833102,
  pubkey: "0355912bc4e61c9715c5912397ea53a5ac6c103c4893fbd9c2a9f3be13b7a3e29d",
  address: "NfMFWYxaUUQy9SYo6AhRiGmRxfPxe9Edj7",
  nonce: "13458238842203010919",
  timestamp: 1616131369,
  signature: "BAS7Ljufj3vrhOrTAi21D/5Cf62n4r64Suf/do8dq/OCMHiLJl+hLJeMFZwTajVjhcpFLz6FuSEp13vvEqWf1w==",
}
```
