signIn
Request a Sign in with Farcaster (SIWF) credential from the user.
See the guide on authenticating users.
A user opens an app and is automatically signed in
Usage
import { sdk } from '@farcaster/miniapp-sdk'
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 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.
type SignInResult = {
signature: string;
message: string;
}
Errors
RejectedByUser
Thrown if a user rejects the sign-in request.
try {
const result = await sdk.actions.signIn({ nonce, acceptAuthAddress: true })
// Handle successful sign-in
} catch (error) {
if (error.name === 'RejectedByUser') {
// Handle user rejection
}
}