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

# Embedded connect

> Recommended connect path — hosted popup or iframe so creators sign in without you handling credentials.

For an in-product connect experience, create a **client session** and render
the hosted page in a popup or iframe. The creator never enters credentials in
your UI, and you never handle a cookie.

## Create the session

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -X POST https://api.onlyfanskit.dev/v1/connect/client-sessions \
  -H "Authorization: Bearer $OFK_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "display_name": "Connect your OnlyFans account",
    "client_reference_id": "user_42"
  }'
```

You get a `client_session_id`, an `embed_url`, and a `phone_url`:

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "client_session_id": "att_...",
  "client_reference_id": "user_42",
  "state": "awaiting_mobile_session",
  "embed_url": "https://api.onlyfanskit.dev/v1/connect/login/att_.../embed?token=...",
  "phone_url":  "https://api.onlyfanskit.dev/v1/connect/login/att_.../phone?token=..."
}
```

## Open the popup

The `onlyfanskit/browser` helper opens `embed_url` in a managed popup and
resolves when the creator finishes:

```ts theme={"theme":{"light":"github-light","dark":"github-dark"}}
import { startOnlyFansAuth } from "onlyfanskit/browser";

const result = await startOnlyFansAuth({ embedUrl });
// result.accountId once connected
```

You can also just link the creator to `phone_url` — it renders a standalone
page they can open on any device.

## Track completion

Poll the session the same way as any attempt
(`GET /v1/connect/login/{client_session_id}`), or attach a
[webhook](/realtime/webhooks) to be notified when the account connects. The
`client_reference_id` you passed is echoed back so you can correlate the
session with your own user.
