Skip to main content
Sirf.one

For developers

Sign in with SIRF

Let people sign in to your website or app with their SIRF account, in one tap. They see exactly what you'll get, and can remove your access any time. You get a verified name, photo, SIRF ID and email, with no passwords to store.

1. Register your app

In Dashboard → Developer apps, add your app name, website and the exact return address(es). Server apps get a client secret (shown once); browser and mobile apps use PKCE instead.

2. Add the button

<button type="button" onclick="SirfSignIn.start({ clientId: 'YOUR_CLIENT_ID', redirectUri: 'https://yourapp.com/sirf-callback' })"
  style="display:inline-flex;align-items:center;gap:10px;padding:10px 18px;border:0;border-radius:999px;background:#7c3aed;color:#fff;font:600 15px system-ui,sans-serif;cursor:pointer">
  <span style="display:grid;place-items:center;width:22px;height:22px;border-radius:6px;background:#fff;color:#7c3aed;font-weight:900">S</span>
  Sign in with SIRF
</button>
<script src="https://sirf.one/sign-in-with-sirf.js"></script>

3. Finish on your return page

<!-- https://yourapp.com/sirf-callback -->
<script src="https://sirf.one/sign-in-with-sirf.js"></script>
<script>
  SirfSignIn.finish({ clientId: 'YOUR_CLIENT_ID', redirectUri: 'https://yourapp.com/sirf-callback' })
    .then(function (result) {
      // result.user = { sub, name, picture, sirf_id, email, email_verified }
      // Send result.id_token to your server and verify it (see "On your server") before trusting it.
    })
    .catch(function (error) { alert(error.message); });
</script>

On your server

# Server apps (with a client secret): exchange the code on your server
POST https://sirf.one/api/oauth/token
Content-Type: application/x-www-form-urlencoded
Authorization: Basic base64(CLIENT_ID:CLIENT_SECRET)

grant_type=authorization_code&code=CODE&redirect_uri=https://yourapp.com/sirf-callback

# Then read the person's details
GET https://sirf.one/api/oauth/userinfo
Authorization: Bearer ACCESS_TOKEN

Verify id_tokens with the keys at /api/oauth/jwks (RS256): issuer https://sirf.one, audience = your client ID, not expired, and your nonce. Any OpenID Connect library can do this from the discovery document.

What you can ask for

  • openid: required; a stable user ID (sub).
  • profile: name, photo, SIRF ID (preferred_username, sirf_id) and profile link.
  • email: email address and whether it is verified.

Access tokens last 1 hour; refresh tokens last 30 days and change each time they are used. Codes last 2 minutes and work once. Sign people out with POST /api/oauth/revoke.

Rules

  • Use the details only for signing people in to your app and running your account with them.
  • Don't show the button in a way that looks like SIRF itself is asking for a password: the sign-in always happens on sirf.one.
  • Apps that mislead people are switched off.