BuiltByBM

BuiltByBM

Add “Log in with BuiltByBM”

Standard OpenID Connect (authorization code + PKCE). Any OIDC library works.

1 · Register the app

Admin → Apps → Connect an app. Add your callback URL. Copy the client ID + secret into the app’s env.

2 · The button
<a href="/api/auth/sso/start" style="display:inline-flex;align-items:center;gap:10px;background:#0b0b0f;color:#fff;font:600 15px Inter,Arial,sans-serif;padding:10px 18px 10px 10px;border-radius:10px;text-decoration:none">
  <img src="https://sso.builtbybm.com/logo.svg" width="28" height="28" alt="" style="border-radius:6px"> Log in with BuiltByBM
</a>
3 · The flow
GET https://sso.builtbybm.com/authorize
  ?response_type=code&client_id=CLIENT_ID
  &redirect_uri=https://app.example.com/api/auth/sso/callback
  &scope=openid%20email%20profile&state=RANDOM&nonce=RANDOM
  &code_challenge=BASE64URL(SHA256(verifier))&code_challenge_method=S256

→ user enters email + 6-digit PIN (skipped if already signed in to BuiltByBM)
→ 302 https://app.example.com/api/auth/sso/callback?code=...&state=...

POST https://sso.builtbybm.com/api/oauth/token
  grant_type=authorization_code&code=...&redirect_uri=...
  &client_id=...&client_secret=...&code_verifier=...
← { access_token, id_token (RS256 JWT: sub, email, name, picture, nonce), expires_in }

Verify the id_token with https://sso.builtbybm.com/api/oauth/jwks (issuer https://sso.builtbybm.com, audience = your client_id). Match users on email, then store sub.

Auth.js / NextAuth
providers: [{
  id: 'builtbybm', name: 'BuiltByBM', type: 'oidc',
  issuer: 'https://sso.builtbybm.com',
  clientId: process.env.SSO_CLIENT_ID, clientSecret: process.env.SSO_CLIENT_SECRET,
}]

Sign-out everywhere: redirect to https://sso.builtbybm.com/logout?post_logout_redirect_uri=https://your-app/