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

# User Authentication

> Secure your agent with built-in authentication and monetization.

Cycls provides built-in authentication to secure your agents. By setting `auth=True`, you can gate access to your agent and manage users effortlessly.

## Enabling Auth

To enable authentication, pass `auth=True` to the `@cycls.app()` decorator:

```python theme={null}
import cycls

@cycls.app(auth=True)
async def app(context):
    # Only authenticated users can reach this code
    user = context.user
    yield f"Hello, {user.email}!"

app.local()
```

## Accessing User Data

When `auth=True`, the `context.user` object is populated with the authenticated user's information:

```python theme={null}
import cycls

@cycls.app(auth=True)
async def app(context):
    user = context.user

    yield f"Hello, {user.name}!\n"
    yield f"Email: {user.email}\n"
    yield f"Organization: {user.org}\n"
    yield f"Plan: {user.plan}"

app.local()
```

### User Properties

| Property | Type     | Description                         |
| :------- | :------- | :---------------------------------- |
| `id`     | `string` | Unique identifier for the user      |
| `email`  | `string` | User's email address                |
| `name`   | `string` | User's full name                    |
| `org`    | `string` | Organization ID the user belongs to |
| `plan`   | `string` | User's subscription plan            |

## Monetization with Cycls Pass

Enable subscription-based access with `plan="cycls_pass"`:

```python theme={null}
import cycls

@cycls.app(auth=True, plan="cycls_pass")
async def app(context):
    user = context.user

    if user.plan == "cycls_pass":
        yield "Welcome, premium user! Here's your exclusive content."
    else:
        yield "Upgrade to Cycls Pass for premium features!"

app.local()
```

When `plan="cycls_pass"` is set:

* Users are prompted to subscribe via Cycls Pass
* Subscription status is available via `context.user.plan`
* You can gate features based on the user's plan

## User Management

When auth is enabled, Cycls handles the entire login flow:

* Sign up / Sign in UI
* Email verification
* Session management
* JWT token handling

User management via the [Cycls Dashboard](https://cycls.com/dashboard) is coming soon.

## Next Steps

<Card title="Cloud Deployment" horizontal href="/core-concepts/deployment">
  Deploy your agent to a global serverless network.
</Card>
