Social login is enabled by your operator (organization), and each
organization uses its own Google/Apple/Microsoft/Meta apps, so the user
sees YOUR brand on the consent screen. Check which providers are active
with
GET /v1/auth/oauth/providers.1. Discover the enabled providers
To render the right buttons, your front end asks which providers are active and with whichclient_id:
client_id is not secret.
2. Get the credential in your front end
Each provider hands you a credential through its own SDK. Minimal examples:- Google
- Apple
- Microsoft
- Meta (Facebook)
With Google Identity Services:
3. Exchange the credential for a session
201:
200 with access_token,
account_id and role (same as password login).
The type field (person | company, default person) is only used when
creating the account; it is ignored if the account already exists.
During attack mode, pow is optional for an existing-user login but required
when this request creates a new account. Obtain it from
POST /v1/auth/pow-challenge with purpose: "oauth" and the provider identity
key as the email value: provider:subject@oauth.local (for example,
google:provider-subject@oauth.local). The challenge is bound to that exact
value and is only for the account-creation path.
How create vs. sign-in is decided
4. Social login and 2FA
OAuth login follows the same factor gate as password login. A new OAuth account returns201 with created: true, account, and status: "pending_2fa_enrollment" instead of a session. An existing member without an enrolled factor receives 200 with the same pending enrollment shape. Follow next and use the returned pending_token with the public registration enrollment endpoints; do not send it as a bearer session.
After TOTP or SMS enrollment, the API returns the normal session. OAuth
auto-linking does not bypass mandatory enrollment. If the account already has
OTP enabled on login, the normal login second step also remains available:
POST /v1/auth/oauth returns otp_required: true and a pending_token,
completed with POST /v1/auth/login/otp. Passkey login with
must_enroll_2fa likewise returns pending_2fa_enrollment; complete the
registration with TOTP or SMS before receiving a session.
5. Link and unlink providers
A signed-in user can manage their sign-in methods:409 last_login_method (set a password or link another provider first).
Errors
FAQ
Do I need to handle redirects or OAuth callbacks?
Do I need to handle redirects or OAuth callbacks?
No. The consent flow happens in your front end with the provider SDK;
you only send the resulting credential to CBPay. There are no callback
pages or server-side state.
What if the provider does not return a verified email?
What if the provider does not return a verified email?
No automatic linking by email (prevents someone from claiming another
person’s email). A standalone account tied to that identity is created;
the user can add email/password later.
Is the provider credential usable as a CBPay token?
Is the provider credential usable as a CBPay token?
No. The provider credential is used once to verify you; every following
call uses the CBPay
access_token.must_enroll_2fa is true, POST /v1/auth/passkey/login/finish returns pending_2fa_enrollment and the member completes the registration wizard before receiving a session. A member still marked RegisterPending (email not yet verified) receives invalid_credential until the mailbox is confirmed; that is separate from the 2FA enrollment gate.