From a connected account to a live video

How a platform connects a creator's BentBox account and publishes a video, step by step, with a small unbranded PHP reference implementation you can copy into your site.

The integration in four steps

Everything runs on your server: the creator's browser never sees a token.

  1. Connect

    Send the creator to BentBox's consent screen with your client_id, scopes and a state value.

  2. Approve

    They sign in and approve. BentBox redirects back to your redirect_uri with a short-lived code.

  3. Exchange

    Your server swaps the code and your client_secret for an access_token and connection_id.

  4. Publish

    Create the video, get a presigned URL, upload the file, then follow its status until it's live.

Connecting an account

The OAuth handshake. Steps 1 to 5 are browser redirects. The exchange in step 6 is server to server, so your client_secret is never exposed.

Creator's browserYour serverBentBox APIGET /connect.php1302 → /oauth/authorize2Sign in and approve3302 → /callback.php?code4GET /callback.php?code5POST /oauth/token6access_token + connection_id7Set bb_conn cookie (encrypted)8

connect.php starts the flow and callback.php receives the creator back; the token exchange is a POST to /oauth/token.

Publishing a video

With the stored token, publishing is two API calls and the file transfer. The demo sends the token in the JSON body and as an Authorization: Bearer header.

Creator's browserYour serverBentBox APIPOST ?action=prepare1POST /v1/content/video2video_id + page links3POST /v1/content/upload-url4Presigned URL5Presigned URL6PUT file to presigned storage7GET /v1/content/video/{video_id}8status, video_settings_url9Show status, link to settings10
In the demoAdd this yourself

POST /v1/content/video reserves the video_id and returns the video's page links. POST /v1/content/upload-url returns a presigned URL, and a PUT sends the bytes. In proxy mode the PUT runs on your server instead of the browser.

The create call also carries consent, either sole_performer: true or a ProntoID release_form_id for other performers, and an optional publish_on_ready (default true) that decides whether the video goes live once processed and approved.

After the upload, poll GET /v1/content/video/{video_id} to show the creator where their video is. When it's draft or action_required, send them to the video_settings_url it returns. The demo stops after the upload, so add this step in your own code.

The files

Nine files, no dependencies. Download them one by one, or the whole package.

Whole package, ready to drop into your web root.

Download .zip

Setup

  1. Copy the folder into your web rootServe it over HTTPS. OAuth and secure cookies require it.
  2. Register your redirect URIAsk BentBox to add the exact URL of callback.php to your redirect URIs.
  3. Generate a cookie keyUse the same value on every server.
  4. Fill in config.phpCredentials, redirect URI, scopes and the key. Then open index.php.
Generate the 32-byte cookie key
php -r "echo base64_encode(random_bytes(32)).PHP_EOL;"