> For the complete documentation index, see [llms.txt](https://docs.justaname.id/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.justaname.id/sdk-reference/justaname-react-sdk/functions/useenssignin.md).

# useEnsSignIn

A React hook for handling ENS-based sign-in authentication with message signing.

***

## Usage

```typescript
import { useEnsSignIn } from '@justaname.id/react'

// Basic usage
function EnsSignInComponent() {
  const { signIn, isSignInPending } = useEnsSignIn()
  
  const handleSignIn = async () => {
    try {
      await signIn({
        ens: 'alice.justaname.eth',
        ttl: 3600,
        uri: 'https://app.justaname.id',
        domain: 'justaname.id'
      })
    } catch (err) {
      console.error('Sign in failed:', err)
    }
  }
  
  return (
    <div>
      <button onClick={handleSignIn} disabled={isSignInPending}>
        {isSignInPending ? 'Signing In...' : 'Sign In with ENS'}
      </button>
    </div>
  )
}
```

```typescript
// With custom backend configuration
function EnsSignInComponent() {
  const { signIn, isSignInPending } = useEnsSignIn({
    backendUrl: 'https://api.justaname.id',
    signinRoute: '/auth/signin',
    signinNonceRoute: '/auth/nonce',
    currentEnsRoute: '/auth/current-ens',
    local: false
  })
  
  const handleSignIn = async () => {
    await signIn({
      ens: 'bob.justaname.eth',
      ttl: 7200,
      uri: 'https://myapp.com',
      domain: 'myapp.com'
    })
  }
  
  return (
    <button onClick={handleSignIn} disabled={isSignInPending}>
      {isSignInPending ? 'Signing In...' : 'Sign In with ENS'}
    </button>
  )
}
```

***

## Returns

[`UseEnsSignInResult`](/sdk-reference/justaname-react-sdk/interfaces/useenssigninresult.md) - An object containing:

* `signIn`: Function to initiate the sign-in process
* `isSignInPending`: Boolean indicating if the sign-in is in progress

## Parameters

* **params?**: [`UseEnsSignInParams`](/sdk-reference/justaname-react-sdk/interfaces/useenssigninparams.md) - Optional parameters for the hook

## Defined in

[packages/@justaname.id/react/src/lib/hooks/signIn/useEnsSignIn.ts:34](https://github.com/JustaName-id/JustaName-sdk/blob/dc845c10af242e3ca87d95ef392516ac0bfa8b95/packages/@justaname.id/react/src/lib/hooks/signIn/useEnsSignIn.ts#L34)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.justaname.id/sdk-reference/justaname-react-sdk/functions/useenssignin.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
