PostSyncer keeps nothing from the sign-in: not the account, its tokens or the person’s details. The proof carries the account’s ID and handle, read from the network at sign-in.
Before you start
- An API key with
accounts:create, the same permission as connect links. Keys made with “All permissions” have it. Make one in Settings → API. The key’s person must be active in PostSyncer. - A signing secret on that key. In Settings → API, open the key’s menu (⋯) and choose Generate signing secret. Copy it: it’s shown once.
Networks
platform is one of these:
Bluesky and Telegram don’t sign in with OAuth, and Mastodon signs in on each server, so none of the three can be used: a session for them is refused with
unsupported_platform.
How it works
1. Start a session
From your server:The absolute URL in your app the user comes back to. Up to 2,048 characters. It may have its own query string: PostSyncer adds its values after it.
A random value you make for this session, up to 512 characters. Keep it on your server, tied to the user who started. It comes back unchanged.
200:
authorize_url works once, within expires_in seconds (15 minutes). It carries only a request token: no key, network or callback.
When starting fails
The key is checked first, then the body. Every error except the validation one has the same shape:403
A missing or invalid
platform, callback_url or state answers the usual validation 422 instead, with message and errors and no code. See Error handling.
2. Send the user to authorize_url
Redirect the user’s browser to authorize_url. PostSyncer sends them on to the network’s sign-in page.
- The network asks the user to allow the same access as when an account is connected to PostSyncer, which can include posting. PostSyncer reads the account’s ID and handle and keeps nothing.
- The sign-in must be finished within 20 minutes of opening the link.
- On X, the user must finish in the same browser they started in.
- The user doesn’t need a PostSyncer account.
3. The user comes back
With a proof
When the sign-in works, the user lands on yourcallback_url with six values added to its query:
The network’s own ID for the account. It doesn’t change, so it’s the value to store and match on.
The account’s username at sign-in, without a leading
@. For showing only: people change handles. It can be empty, as the network table says.The HMAC-SHA256 of
platform={platform}&platform_id={platform_id}&handle={handle}&state={state}&expires={expires} with your signing secret, in lowercase hex.Example callback
With an error
When something goes wrong, the user lands on yourcallback_url with error, error_description and your state, and no sig. Treat any callback with error as a failed check, and offer to start again with a new session.
Accept the first answer for a state
A user can come back more than once for the same session: with the Back button, a reload, or a second tab. After a proof, a second return for the same state arrives with error=invalid_state. Act on the first answer you get for a state, and once you’ve accepted a proof for it, ignore every later one.
When PostSyncer can’t send the user back
For a link PostSyncer never issued, or one more than about a day old, PostSyncer no longer knows yourcallback_url. The user then sees PostSyncer’s own page at /oauth/delegate?error=..., which says the link has expired, or that their account couldn’t be connected, and to go back to the app that sent them and start again. Your server gets nothing in that case, so let users start again from your side.
4. Check the proof
On your server, before you trustplatform_id:
stateis one you issued for this user and haven’t used. Mark it used.expiresis in the future.sigmatches the HMAC you work out over the exact base string. Compare in constant time.
platform_id the account the user owns.
Limits
- The delegation endpoints take 120 requests a minute from one IP address. See Rate limits.
- Delegation works on every plan, Free included. Sessions don’t count as posts or as connected accounts.
Related
Authentication
Make the key and choose its permissions.
Error handling
Every delegation error, with the API’s others.
Connect social accounts
Connect an account to post with it.