---
title: Function: useAuth
slug: chord-ui/function-useauth
docTags: 
createdAt: 2023-11-06T15:03:31.904Z
---

[react-autonomy](docId\:zoZ6W56ubpPACr0PO0GLS).useAuth

▸ **useAuth**\<`T`>(): [`UseAuth`](docId\:JGH3iJcYwDl5t0PFiiaLj)\<`T`>

The `useAuth` hook returns information about the current authentication
session, and functions for logging in and logging out. Chord's preferred
authentication provider is [Magic](https://magic.link/) through our
[chord-magic package](https://github.com/chordcommerce/chord-ui/pkgs/npm/chord-magic).



```javascript
import { useAuth } from '@chordcommerce/react-autonomy'

const AccountPage = () => {
  const { isLoggedIn } = useAuth()
  if (!isLoggedIn) return

  // return account page
}
```

### Type parameters

| Name | Type                                                                      |
| ---- | ------------------------------------------------------------------------- |
| `T`  | extends [`AuthClient`](docId\:JisGs4kxNBQanNKBxHaw-)\<`any`, `T`> = `any` |

### Returns

[`UseAuth`](docId\:JGH3iJcYwDl5t0PFiiaLj)\<`T`>

### Defined in

[packages/react-autonomy/src/hooks/use-auth.ts:40](https://github.com/chordcommerce/chord-ui/blob/2b105e1/packages/react-autonomy/src/hooks/use-auth.ts#L40)
