> For the complete documentation index, see [llms.txt](https://trixtateam.gitbook.io/trixta-js-core/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://trixtateam.gitbook.io/trixta-js-core/reference/hooks/usetrixtaauth.md).

# useTrixtaAuth

A react hook that will return authentication and authorization info.

```jsx
import { useTrixtaAuth } from '@trixtateam/trixta-js-core';
const { 
isAuthenticated,
hasRole,
hasAccess,
isAuthorizing 
} = useTrixtaAuth({ roleName });

```

### Options

* `roleName : string?`
  * Optional
  * Trixta role name

### Returns

* `isAuthenticated : boolean`

  * Will be `true` if the Trixta space connected with token parameter.

* `hasRole : boolean`
  * Will be `true` if the passed `roleName` for the current user has access.<br>

* `hasAccess : boolean`

  * Will be `true` if the `hasRole` and `isAuthenticated` mentioned above is `true`.

* `isAuthorizing : boolean`
  * Will be `true` if Trixta is still authorizing the above mentioned `roleName`
