> For the complete documentation index, see [llms.txt](https://xircus-developer.gitbook.io/developer-hub/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://xircus-developer.gitbook.io/developer-hub/react-reference/recipes/using-wallet-authentication.md).

# Using Wallet Authentication

{% tabs %}
{% tab title="React" %}

```javascript
import { useTonConnect, useTonAuth } from "@xircus-web3/ton-react"

export default function Index() {
  const wallet = useTonConnect()
  const auth = useTonAuth()

  if (wallet.status == "connected") {
    return (
      <div>
        <div>{wallet.account}</div>
        <div>{wallet.balance}</div>
        <button onClick={wallet.disconnect}>Disconnect</button>
        <button onClick={auth.auth}>Authenticate</button>
        <div>{auth?.user?.username}</div>
      </div>
  }
          
  return (
    <div>
      <button onClick={wallet.connectMetamask}>Connect Metamask</button>
    </div>
  )
}
```

{% endtab %}
{% endtabs %}
