Skip to main content
Single sign-on (SSO) lets a customer who is signed in to your app open OnlySocial without a password. Your backend vouches for them with a short-lived token signed with your SSO secret; OnlySocial swaps it for a one-time sign-in link, and you send their browser there.

1. Provision the customer

Create the account the first time you see a customer, and again whenever their name or e-mail changes in your app. The same request creates or refreshes, so it is safe to repeat.
200
A new customer gets their own workspace, ready to use. Keep workspace_id: it is what workspace API keys and Channel Connect take.

What outcome tells you

workspace_ids lists every workspace the customer administers, oldest first, so workspace_ids[0] is always workspace_id. More than one appears if somebody later made them an admin of another workspace; pass the uuid you mean. A workspace they are only a member of is not listed.
If warnings contains existing_account_linked_without_workspace, the customer administers no workspace at the moment, and workspace_id is null. There is nothing to issue a key for or connect a channel in until somebody makes them an admin of a workspace.
GET /api/partner/users/{external_id} returns the same customer, with is_active and last_sso_login, or 404 for an external_id you have not provisioned.

Conflicts

An e-mail address that already belongs to someone else is never taken over. You get a 409 with a stable error_code, and nothing is written: A 422 means a field failed validation (see errors). A 400 means the request was refused, for example an e-mail outside your allowed domains.

2. Sign a token

When the customer clicks through from your app, sign a JSON Web Token on your backend with HS256 and your SSO secret.
partner is your partner identifier. No partner key is sent: the signature is the proof.
200
If the sub has never been provisioned, this call provisions the customer first, with the same rules and conflicts as step 1, and a workspace of their own. Provisioning up front is still worth it if you need the workspace_id before the customer’s first visit.

4. Send the browser

Redirect the customer’s browser to authentication_url. The link works once, within 5 minutes, and leaves them signed in to OnlySocial. To land somewhere other than the dashboard home, add redirect:
That example opens the posts list of workspace 6b1f0e2c-…. URL-encode the value. redirect may be a path on app.onlysocial.io, or a full https:// URL on app.onlysocial.io or on your own app’s registered address. Anything else is ignored and the customer lands on the dashboard home. If the link has expired or was already used, the customer sees the OnlySocial sign-in page with an error. Generate a fresh link each time someone clicks through; never store or share one.

Errors from the exchange

Every provisioning call and sign-in, successful or not, is recorded in OnlySocial’s SSO log for your partner account.