Also available: Markdown version · llms.txt · full site content
Authentication
Google sign-in
Create an OAuth client in the Google Cloud Console, paste its credentials into CubiBase, and register the callback URL. Two flows: browser redirect, or a Google ID token your app already holds.
Configure it step by step
Everything happens in two places: console.cloud.google.com for the Google side, and Console → project → Auth → Providers → Google for the CubiBase side.
Google: select or create a project
Open console.cloud.google.com and pick the Google Cloud project for your app.
Google: configure the OAuth consent screen
APIs & Services → OAuth consent screen. Choose External, fill in the app name and the support and developer contact emails, and add the scopes openid, email, and profile. While the app is in Testing, only listed test users can sign in; publish to production when you are ready for everyone.
Google: create an OAuth client
APIs & Services → Credentials → Create credentials → OAuth client ID → Web application.
Google: register the redirect URI
Copy the Authorized redirect URI that the CubiBase Google section displays — it looks like https://{slug}.api.cubibase.com/auth/v1/callback?provider=google&project={projectId}. Paste it exactly, query parameters included.
CubiBase: enable the provider
In Auth → Providers → Google, tick Enable Google sign-in, paste the Client ID and Client secret, and save. The secret is stored encrypted and never shown again; the section shows a Secret stored badge instead.
CubiBase: allowlist your app’s URLs
In the same form, fill the App redirect allowlist with the URLs in your app that should receive the session — one per line; a trailing * allows prefix matches. Loopback HTTP redirect URLs are always allowed for native and local development.
The browser redirect flow
Your app
asks for a consent url
CubiBase Auth
single-use state
Google
user consents
CubiBase callback
verifies code + state
Your app starts the flow with GET /auth/v1/authorize?provider=google&redirect_to={your callback URL}, sending the publishable key. The response contains a url: send the browser there.
GET https://example-project.api.cubibase.com/auth/v1/authorize?provider=google&redirect_to=https%3A%2F%2Fapp.example.com%2Fauth%2Fcallback
apikey: cb_pub_EXAMPLE_ONLY{
"url": "https://accounts.google.com/o/oauth2/v2/auth?client_id=…&redirect_uri=…&response_type=code&scope=openid%20email%20profile&state=…",
"state": "<SINGLE_USE_STATE>",
"expiresAt": "2026-11-20T10:10:00.000Z"
}Google shows its consent screen and redirects back to the CubiBase callback, which verifies the response and redirects the browser to your redirect_to with the session in the URL fragment (the part after #).
https://app.example.com/auth/callback#access_token=<ACCESS_JWT>&refresh_token=<REFRESH_TOKEN>&token_type=Bearer&expires_in=3600&expires_at=2026-11-20T11%3A00%3A00.000ZThe ID-token flow (mobile and web SDKs)
If your app already obtains a Google ID token — Google Sign-In on Android, iOS, or the web — skip the redirect flow and POST it to /auth/v1/token?grant_type=id_token with the publishable key.
POST https://example-project.api.cubibase.com/auth/v1/token?grant_type=id_token
apikey: cb_pub_EXAMPLE_ONLY
Content-Type: application/json
{
"provider": "google",
"idToken": "<GOOGLE_ID_TOKEN>"
}CubiBase verifies the token’s RS256 signature against Google’s published keys, the issuer, the audience (your Client ID), and the expiry, then returns a normal session. Pass a nonce to bind the token to your sign-in attempt.
Identity rules (both flows)
| Situation | What happens |
|---|---|
| Google account has signed in before | Signs straight in |
| Request carries an end-user bearer token | The Google identity links to that user — the anonymous upgrade path |
| Verified Google email matches an existing user | The identity attaches to that account |
| New Google account | Signs up a new user (the signup switch applies) |
| User has a verified factor, project requires MFA | 403 mfa_required — Google alone does not satisfy MFA |