|
| 1 | +# `authenticate` |
| 2 | + |
| 3 | +Submit a Sign In With Farcaster message, user signature, and profile data to the Connect relay server. |
| 4 | + |
| 5 | +```ts |
| 6 | +const params = await authClient.authenticate({ |
| 7 | + message: 'example.com wants you to sign in with your Ethereum account…', |
| 8 | + signature: '0x9335c3055d47780411a3fdabad293c68c84ea350a11794cdc811fd5…', |
| 9 | + fid: 1, |
| 10 | + username: 'alice', |
| 11 | + bio: "I'm a little teapot who didn't fill out my bio", |
| 12 | + displayName: 'Alice Teapot', |
| 13 | + pfpUrl: 'https://images.example.com/profile.png', |
| 14 | +}); |
| 15 | +``` |
| 16 | + |
| 17 | +## Parameters |
| 18 | + |
| 19 | +| Parameter | Type | Description | Required | |
| 20 | +| -------------- | -------- | ----------------------------------------------------------------------------------------------- | -------- | |
| 21 | +| `authKey` | `string` | Farcaster Connect API key. Farcaster Connect v1 restricts calls to `/authenticate` to Warpcast. | Yes | |
| 22 | +| `channelToken` | `string` | Farcaster Connect channel token. | Yes | |
| 23 | +| `message` | `string` | The Sign in With Farcaster message produced by your wallet app and signed by the user. | Yes | |
| 24 | +| `message` | `string` | The Sign in With Farcaster message produced by your wallet app and signed by the user. | Yes | |
| 25 | +| `signature` | `Hex` | SIWE signature created by the wallet user's account. | Yes | |
| 26 | +| `fid` | `number` | Wallet user's fid. | Yes | |
| 27 | +| `username` | `string` | Wallet user's Farcaster username. | Yes | |
| 28 | +| `bio` | `string` | Wallet user's bio. | Yes | |
| 29 | +| `displayName` | `string` | Wallet user's display name. | Yes | |
| 30 | +| `pfpUrl` | `string` | Wallet user's profile photo URL. | Yes | |
| 31 | + |
| 32 | +## Returns |
| 33 | + |
| 34 | +```ts |
| 35 | +{ |
| 36 | + response: Response |
| 37 | + data: { |
| 38 | + state: 'completed' |
| 39 | + nonce: string |
| 40 | + message?: string |
| 41 | + signature?: `Hex` |
| 42 | + fid?: number |
| 43 | + username?: string |
| 44 | + bio?: string |
| 45 | + displayName?: string |
| 46 | + pfpUrl?: string |
| 47 | + } |
| 48 | + isError: boolean |
| 49 | + error: Error |
| 50 | +} |
| 51 | +``` |
| 52 | + |
| 53 | +| Parameter | Description | |
| 54 | +| ------------------ | ----------------------------------------------------------------- | |
| 55 | +| `response` | HTTP response from the Connect relay server. | |
| 56 | +| `data.state` | Status of the sign in request, either `"pending"` or `"complete"` | |
| 57 | +| `data.nonce` | Random nonce used in the SIWE message. | |
| 58 | +| `data.message` | The generated SIWE message. | |
| 59 | +| `data.signature` | Hex signature produced by the user's Warpcast wallet. | |
| 60 | +| `data.fid` | User's Farcaster ID. | |
| 61 | +| `data.username` | User's Farcaster username. | |
| 62 | +| `data.bio` | User's Farcaster bio. | |
| 63 | +| `data.displayName` | User's Farcaster display name. | |
| 64 | +| `data.pfpUrl` | User's Farcaster profile picture URL. | |
| 65 | +| `isError` | True when an error has occurred. | |
| 66 | +| `error` | `Error` instance. | |
0 commit comments