> ## Documentation Index
> Fetch the complete documentation index at: https://docs.neynar.com/llms.txt
> Use this file to discover all available pages before exploring further.

# signIn

> Sign in the user with Farcaster

Request a [Sign in with Farcaster
(SIWF)](https://docs.farcaster.xyz/developers/siwf/) credential from the user.

See the guide on [authenticating users](/miniapps/guides/auth).

<img src="https://mintcdn.com/neynar/Uxa-Ieom0HVNjtON/miniapps/sign_in_preview.png?fit=max&auto=format&n=Uxa-Ieom0HVNjtON&q=85&s=6f4ba6bc514839762da8596c82c75049" alt="signing in a user" width="1756" height="1194" data-path="miniapps/sign_in_preview.png" />

*A user opens an app and is automatically signed in*

## Usage

```ts theme={"system"}
import { sdk } from '@farcaster/miniapp-sdk'

// Generate a cryptographically secure random nonce on your server
const nonce = 'securenonce';

await sdk.actions.signIn({
  nonce,
  acceptAuthAddress: true
})
```

## Parameters

### nonce

* **Type:** `string`

A random string used to prevent replay attacks, at least 8 alphanumeric
characters.

### acceptAuthAddress

* **Type:** `boolean`

Whether an [Auth
Address](https://github.com/farcasterxyz/protocol/discussions/225) signed
message is acceptable. Defaults to `true` for the best user experience.
Set to `false` if your verification method does not support auth addresses.

## Return Value

The SIWF message and signature.

```ts theme={"system"}
type SignInResult = {
  signature: string;
  message: string;
}
```

<Note>
  This message must be sent to your server and verified. See the guide on
  [authenticating with Farcaster](/miniapps/guides/auth) for more information.
</Note>

## Errors

### `RejectedByUser`

Thrown if a user rejects the sign-in request.

```ts theme={"system"}
try {
  const result = await sdk.actions.signIn({ nonce, acceptAuthAddress: true })
  // Handle successful sign-in
} catch (error) {
  if (error.name === 'RejectedByUser') {
    // Handle user rejection
  }
}
```

[If you're an AI agent or LLM, please read this.](/miniapps/guides/agents-checklist)
