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
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.
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 a409 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.3. Exchange it for a sign-in link
partner is your partner identifier. No partner key is sent: the signature is the proof.
200
4. Send the browser
Redirect the customer’s browser toauthentication_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:
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.
