Continue With Sync

Let people sign in to your app with their Sync account. You get a verified identity and only the permissions the user approves. Your app's data stays on your own servers.

Developer portal

Quick start

Follow these four steps in order. Every URL below is exact. Only replace the values in CAPITALS and your own domain.

Step 1: create an app

  1. Open the Developer portal and sign in.
  2. Create an app with one authorised domain, such as example.com. Use the bare domain, with no https://, path or port.
  3. Add a logo link if you have one. It's optional, and people see it when they sign in. Use a direct https link to a square picture under 1 MB.
  4. Copy the client secret straight away. It is shown once.

Step 2: send the user to sign in

Open this URL in the user's browser. The user signs in, approves, and is redirected to your redirect URL with ?code= and your state.

https://auth.sync-ai.app/auth?site=My%20App&redirect=https://example.com/sync/callback&auth=name&auth2=email&state=RANDOM_STATE

Step 3: exchange the code (server only)

This must be a POST to exactly https://auth.sync-ai.app/oauth/token. It returns an access_token.

curl -X POST "https://auth.sync-ai.app/oauth/token" \
  -H "Content-Type: application/json" \
  -d '{"grant_type":"authorization_code","code":"CODE_FROM_REDIRECT","client_secret":"YOUR_CLIENT_SECRET","redirect_uri":"https://example.com/sync/callback"}'

Step 4: read the user's data (server only)

curl "https://auth.sync-ai.app/api/userinfo" \
  -H "Authorization: Bearer ACCESS_TOKEN"

Check your setup

Run this to confirm the endpoint is reachable before you write any code.

curl -i -X POST "https://auth.sync-ai.app/oauth/token" \
  -H "Content-Type: application/json" \
  -d '{"grant_type":"authorization_code","code":"test","client_secret":"test","redirect_uri":"https://example.com/x"}'

# Expected: HTTP 401 with {"error":"invalid_client",...}
# That proves the endpoint exists. Only your secret is wrong for real use.
# A 404 means the URL or method is wrong.
404 means the URL or method is wrong. 401 invalid_client means the endpoint is correct and only the secret is wrong.

Full server example

const SYNC = "https://auth.sync-ai.app";
const CLIENT_SECRET = process.env.SYNC_CLIENT_SECRET; // server only, never in browser code
const REDIRECT_URI = "https://example.com/sync/callback";

// Step 1: send the user here (use as a link or button)
function loginUrl(state) {
  const u = new URL("/auth", SYNC);
  u.searchParams.set("site", "My App");
  u.searchParams.set("redirect", REDIRECT_URI);
  u.searchParams.set("auth", "name");
  u.searchParams.set("auth2", "email");
  u.searchParams.set("state", state); // random value, saved in the user's session
  return u.href;
}

// Step 2: your /sync/callback route calls this with the URL Sync redirected to
async function handleCallback(url, expectedState) {
  if (url.searchParams.get("state") !== expectedState) throw new Error("state mismatch");
  const code = url.searchParams.get("code");
  if (!code) throw new Error("user cancelled or no code");

  // Step 3: exchange the code (POST, server side)
  const tokenRes = await fetch(SYNC + "/oauth/token", {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({ grant_type: "authorization_code", code, client_secret: CLIENT_SECRET, redirect_uri: REDIRECT_URI }),
  });
  if (!tokenRes.ok) throw new Error("token exchange failed: " + tokenRes.status + " " + (await tokenRes.text()));
  const { access_token } = await tokenRes.json();

  // Step 4: read what the user approved
  const infoRes = await fetch(SYNC + "/api/userinfo", { headers: { Authorization: "Bearer " + access_token } });
  if (!infoRes.ok) throw new Error("userinfo failed: " + infoRes.status);
  return infoRes.json(); // { sub, name, email }
}

2. Exchange the code

Method: POST. URL: https://auth.sync-ai.app/oauth/token. Body: JSON (Content-Type: application/json) or form-encoded.

FieldValue
grant_typeauthorization_code (exact text)
codeThe code from the redirect. Single use, valid for 5 minutes.
client_secretYour app's secret from the Developer portal
redirect_uriThe same redirect URL you sent in step 1, exactly

Rules

Request

curl -X POST "https://auth.sync-ai.app/oauth/token" \
  -H "Content-Type: application/json" \
  -d '{"grant_type":"authorization_code","code":"CODE_FROM_REDIRECT","client_secret":"YOUR_CLIENT_SECRET","redirect_uri":"https://example.com/sync/callback"}'

Success response (200)

{"access_token":"…","token_type":"Bearer","scope":"name email","inactive_expires_in_days":31,"max_lifetime_days":90}

Errors

StatusMeaning
400 invalid_grantCode is wrong, expired, already used, or redirect_uri does not match.
401 invalid_clientclient_secret is wrong, or redirect_uri is not an authorised domain of the app.
400 unsupported_grant_typegrant_type must be exactly authorization_code.
405You sent GET. Use POST.
404Wrong URL. The path is /oauth/token, with no /api.

3. Read the user's data

Method: GET. URL: https://auth.sync-ai.app/api/userinfo. Header: Authorization: Bearer ACCESS_TOKEN. No sign-in is needed.

sub is always returned: the user's stable Sync ID. Other fields appear only for permissions the user approved.

FieldNeeds permissionValue
subAlwaysStable user ID
namenameDisplay name, or null
emailemailEmail address, or null
bannedbannedtrue or false
taskstasksThe user's scheduled tasks, including prompts. Sensitive.

Request

curl "https://auth.sync-ai.app/api/userinfo" \
  -H "Authorization: Bearer ACCESS_TOKEN"

Example response

{"sub":"firebase-uid","name":"Luca","email":"you@example.com"}

Errors

StatusMeaning
401 invalid_tokenHeader missing, token wrong, expired (31 days idle or 90 days old), or revoked.

Permissions

Ask only for what you need. The user sees each permission before approving.

ValueShown to the user asYou receive
nameSee your full namename
emailSee your email addressemail
tasksSee your scheduled tasks in Dash, including what you wrote in themtasks: full task list, including prompts
bannedCheck if your account is bannedbanned: true or false

Expiry and revocation

Try it

Each button opens the consent page. Continue returns to this site's test callback, which exchanges the code and shows the result. Use your own account.

All permissions, Terms and PrivacyContinue With Syncname, email, tasks, banned, both policy links, state=demo-all
Name and email onlyContinue With Syncauth=name, auth2=email
Banned check onlyContinue With Syncauth=banned
No Terms or Privacy policyContinue With SyncShows the warning line. auth=name only
Terms onlyContinue With SyncShows Terms link and a missing Privacy warning
Test error: missing redirectContinue With SyncShould show 400 - Authentication Failed / Missing Params or Data UID
Test error: unknown permissionContinue With SyncShould show 400 with the bad value in View error details
Test error: unregistered domainContinue With SyncShould show 400 because example.com is not an authorised domain

Back to the test app