> ## Documentation Index
> Fetch the complete documentation index at: https://docs.playtolia.com/llms.txt
> Use this file to discover all available pages before exploring further.

# PlaytoliaAuth

> Authentication state and login dialog management

Manages the login dialog and auth session. All other components depend on a valid auth state.

### Methods

| Method                     | Parameters                | Returns      | Notes                              |
| -------------------------- | ------------------------- | ------------ | ---------------------------------- |
| `PromptLogin(dismissable)` | `bool dismissable = true` | `void`       | Shows login dialog                 |
| `CancelLogin()`            | —                         | `void`       | Dismisses login dialog             |
| `Logout(promptLogin)`      | `bool promptLogin = true` | `void`       | Clears session; re-prompts if true |
| `IsLoggedIn()`             | —                         | `bool`       | True when auth state is non-null   |
| `GetAccessToken()`         | —                         | `string`     | Empty string if not logged in      |
| `GetState()`               | —                         | `AuthState?` | Null if not logged in              |
| `AddListener(listener)`    | `Action`                  | `void`       | Called on any auth state change    |
| `RemoveListener(listener)` | `Action`                  | `void`       |                                    |

### AuthState

| Field                    | Type     | Notes          |
| ------------------------ | -------- | -------------- |
| `AccessToken`            | `string` | JWT            |
| `RefreshToken`           | `string` |                |
| `Expiration`             | `long`   | Unix timestamp |
| `RefreshTokenExpiration` | `long`   | Unix timestamp |

<Info>Tokens refresh automatically. You don't need to handle expiry manually.</Info>
