WEBVTT

00:00:00.860 --> 00:00:05.700
Building a CRM, an AI chatbot, or another tool for OnlyFans?

00:00:05.980 --> 00:00:08.780
Your customers need a way to connect their own accounts.

00:00:08.860 --> 00:00:11.820
Here's how to add that flow to your app, and reconnect an account when

00:00:11.900 --> 00:00:15.260
its session expires. Watch the code on the left and the app on the

00:00:15.420 --> 00:00:18.620
right. First, the user clicks Connect account.

00:00:18.700 --> 00:00:21.820
Your browser asks your own backend for a client session.

00:00:21.900 --> 00:00:25.980
The backend calls Fans API with your API key and a display name.

00:00:26.060 --> 00:00:28.300
Keep that API key on the server.

00:00:28.500 --> 00:00:30.780
Return the client session token to the browser.

00:00:30.860 --> 00:00:33.900
Pass that token to start OnlyFans Authentication.

00:00:33.980 --> 00:00:35.740
The hosted popup opens.

00:00:35.780 --> 00:00:39.020
The creator enters their OnlyFans email and password there.

00:00:39.060 --> 00:00:41.900
If verification is required, the popup handles it.

00:00:41.980 --> 00:00:44.460
Your app doesn't need its own password form.

00:00:44.540 --> 00:00:48.060
When login succeeds, onSuccess gives you an account ID.

00:00:48.140 --> 00:00:50.140
Save it against the creator in your app.

00:00:50.220 --> 00:00:51.940
This is the ID you'll reuse.

00:00:52.180 --> 00:00:56.500
Next, add a webhook endpoint on your server and subscribe to the account events

00:00:56.620 --> 00:01:00.580
shown here. This keeps your app updated after the popup closes.

00:01:00.820 --> 00:01:05.220
Verify the signature, save the event, and return a successful response.

00:01:05.460 --> 00:01:10.020
Your worker refreshes the account's current status, because events can repeat or arrive

00:01:10.100 --> 00:01:14.980
out of order. Later, a creator may change their password when switching agencies.

00:01:15.060 --> 00:01:18.500
That's a normal security step, and it can expire the session.

00:01:18.580 --> 00:01:22.660
Your server then receives accounts.session_expired.

00:01:22.780 --> 00:01:25.380
Match the account ID to the customer in your app.

00:01:25.420 --> 00:01:29.620
If the account still needs a new login, show Reconnect on that same record.

00:01:29.957 --> 00:01:33.180
On your backend, check that this user can manage the account.

00:01:33.260 --> 00:01:37.420
Then create a new client session with account underscore ID set to the saved

00:01:37.500 --> 00:01:41.020
ID. Leave the name, proxy, and permissions alone.

00:01:41.100 --> 00:01:45.393
Send the new token back to the browser and call update OnlyFans Credentials.

00:01:45.447 --> 00:01:48.620
This opens the existing popup in credential-update mode.

00:01:48.660 --> 00:01:50.567
The email is already filled in.

00:01:50.593 --> 00:01:53.820
The creator can edit it, but they must sign in to the same OnlyFans

00:01:53.900 --> 00:01:56.433
profile. The password starts empty.

00:01:56.487 --> 00:01:58.407
Let's use the wrong password once.

00:01:58.433 --> 00:01:59.980
The popup shows the error.

00:02:00.060 --> 00:02:02.993
Try again keeps the email and clears the password.

00:02:03.047 --> 00:02:04.820
It never deletes the account.

00:02:04.860 --> 00:02:06.980
Enter the correct password and submit.

00:02:07.020 --> 00:02:10.087
After a successful login, refresh the existing row.

00:02:10.113 --> 00:02:12.167
The account ID hasn't changed.

00:02:12.273 --> 00:02:15.380
Closing the popup doesn't cancel a login that's already running.

00:02:15.420 --> 00:02:17.607
Reopen the same token to continue.

00:02:17.633 --> 00:02:21.820
An update token accepts new submissions for 30 minutes, with up to 3 attempts

00:02:21.900 --> 00:02:23.220
per account per minute.

00:02:23.260 --> 00:02:25.831
After success, get a fresh token next time.

00:02:25.900 --> 00:02:30.593
One last distinction. The reauthenticate endpoint retries saved credentials.

00:02:30.647 --> 00:02:33.060
This popup collects replacement credentials.

00:02:33.100 --> 00:02:34.700
Use the one that matches the job.
