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.
Connect
Send the creator to BentBox's consent screen with your
client_id, scopes and astatevalue.Approve
They sign in and approve. BentBox redirects back to your
redirect_uriwith a short-livedcode.Exchange
Your server swaps the code and your
client_secretfor anaccess_tokenandconnection_id.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.
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.
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- config.php Your settings: credentials, redirect URI, scopes, cookie key. Setup Download
- bentbox.php The library: HTTP, OAuth, encrypted-cookie token store, upload calls. Core Download
- partials.php Shared, unbranded page chrome and CSS. UI Download
- index.php Landing page: explains the flow, shows connection status. Overview Download
- connect.php Starts OAuth: sets the state cookie, redirects to BentBox. Step 1 Download
- callback.php Redirect target: verifies state, exchanges the code, stores tokens. Steps 2–3 Download
- upload.php Upload UI and server actions: create, sign, PUT. Step 4 Download
- README.md Full setup walkthrough and API reference. Docs Download
- flow.php This page. Docs Download
Setup
- Copy the folder into your web rootServe it over HTTPS. OAuth and secure cookies require it.
- Register your redirect URIAsk BentBox to add the exact URL of
callback.phpto your redirect URIs. - Generate a cookie keyUse the same value on every server.
- Fill in
config.phpCredentials, redirect URI, scopes and the key. Then openindex.php.
php -r "echo base64_encode(random_bytes(32)).PHP_EOL;"