Skip to content
BuildBase

Set up sign-in, step by step

The pieces of BuildBase sign-in in plain words, the order to set them up in, and a guide for every way your users can sign in.

BuildBase runs the sign-in for your app. Your users press Sign in in your app, land on a sign-in page that BuildBase hosts for you, sign in there with the methods you chose, and come back to your app signed in. This page explains the pieces you set up in the BuildBase console, the order to set them up in, and how to test it all with an account of your own. The guides after it take each way of signing in one at a time.

The examples use an organization called Acme with one app, Acme Analytics, that will live at https://app.acme.example.

Before you start

  • A BuildBase organization, and a console role that can change authentication settings.
  • An email address you can read, to test with.
  • For the last step only: someone who can change your app's code.

The pieces

PieceWhat it isWhere it is in the console
Your organizationYour company in BuildBase, here Acme. Your users, apps and settings all belong to it.The whole console: you always work inside one organization
An app, or "client"Each website or app that people sign in to. It has a client ID, which goes in your app's code and is safe to share, and a client secret, which only your server may know.Authentication, Settings tab
Redirect URLsThe addresses of your app that people are sent back to after they sign in. Each app keeps its own list.The app's Edit sheet
Sign-in methodsThe ways people can sign in: email and password, an emailed link or code, Google, a phone code and more. You add each one once, for the whole organization.Authentication, Methods tab
The hosted sign-in pageThe page BuildBase shows your users. It shows only the methods ticked on the app they came from, in your name, colours and words, in any of 8 languages.Branding, under Access
The live previewA picture of your sign-in page beside its settings, which follows your edits before you save.Branding page, on the right
An email senderThe email account sign-in codes, links and password resets are sent from. Without one, no sign-in email goes out.Messaging, Sender accounts
The SDK in your appThe @buildbase/sdk package your developers add to your app. It shows the Sign in button, sends people to the hosted page, and shows account screens such as Security inside your app.Your app's code

The order to do things in

  1. Connect an email sender, under Messaging, Sender accounts. Most methods send an email at some point: a verification code, a reset code or a sign-in link. See the email sender.
  2. Create your app (a client) on the Settings tab, copy its secret, and add its redirect URLs.
  3. Add the sign-in methods you want on the Methods tab. The guides below say what each one needs first.
  4. Tick the methods on your app, in its Edit sheet, and press Update. A method shows on the sign-in page only once it is ticked on the app.
  5. Decide who can sign up on the Sign-up tab, and turn on bot protection on the Security tab before you go live.
  6. Make the page yours on the Branding page: name, logo, colours and words.
  7. Test it with Test beside your app, using an account of your own.
  8. Connect your app's code with the SDK.

Find the Authentication area

Open Authentication in the console

(opens the console in a new tab)

In the console's left rail, choose Users. The User management menu opens. Choose Authentication under Access. Everything on this page happens in its tabs: Settings, Methods, Sign-up, Security, SMS, Domains, Enterprise, Agent readiness and Audit. What the sign-in page looks like is on its own page, Branding, just under Authentication.

The console with User management open in the menu and Authentication, highlighted, under Access, with Branding below it. Tabs across the top: Settings, Methods, Sign-up, Security, SMS, Domains, Enterprise and Agent readiness, and the Settings tab lists the client Acme Analytics, with Edit and Test buttons

Your app and its redirect URLs

The Settings tab lists your apps. The How to connect your app guide on it walks through the whole connection in five steps.

How to connect your app, opened by its highlighted title on the Settings tab: five numbered steps, from pressing Create auth client and copying the client secret, through adding a redirect URL and ticking methods with Edit, to the three settings your app needs and pressing Test

  1. Press Create auth client. Type a Title your team will recognise, such as Acme Analytics, keep the type Your app's sign-in, and press Create.
  2. The console shows the organization ID, the client ID and the client secret. Copy the secret now, with Copy client secret or Copy all three: it is shown only once. If it is lost, Regenerate in the Edit sheet makes a new one.
  3. Press I've copied the secret, then press Edit on the new app.
  4. Under Redirect URLs, press Add redirect URL and type each address your app uses for signing in, for example http://localhost:3000/callback while you test on your computer and https://app.acme.example/callback for the live app.
  5. Press Update at the bottom of the sheet.

Redirect URLs in the Edit auth setting sheet for Acme Analytics: http://localhost:3000/callback for testing and https://app.acme.example/callback for the live app, each with a remove button, and the Add redirect URL button below them highlighted as step 4

A redirect URL has to match letter for letter: http or https, the domain, the port and the path, even a slash at the end. On your own computer (localhost) the port may differ. For an app with a subdomain per customer, one entry with a * as the first part covers them all, such as https://*.app.acme.example/callback. An address missing from the list stops sign-in with "Invalid redirect URL". The going-live checklist covers adding the live address.

Add a sign-in method

Open the Methods tab. Login methods lists the methods your organization has. Each row says, in one line, what the person signing in does.

The Methods tab: the Login methods card says a method appears on a sign-in page only once you tick it on a client, and lists two methods, Email/Password and Magic link, with the Add auth method button highlighted

Press Add auth method. Each choice says what it is for and what else it needs. Pick one, fill in what it asks for, and press Create. The guide for each method, listed at the end of this page, covers its fields.

The Add new method dialog: one button per way to sign in (Email/Password, Magic link, Passkey, Phone, Guest, Wallet, Enterprise SSO, Google, LinkedIn, GitHub, Microsoft, Apple, Lovable, Vercel and Custom OIDC provider) with Magic link chosen and highlighted, and under them what Magic link is for and what else it needs

A method your plan does not include is greyed out, and pointing at it says "Your plan does not include" and the feature. Signing in on a TV or in a command line tool is not a method here: it is a switch on an OAuth 2.0 client. See Device code sign-in.

Attach a method to your app

A method shows on the sign-in page only once it is ticked on the app. Adding it on the Methods tab is not enough.

  1. Open the Settings tab and press Edit beside Acme Analytics.
  2. Under Methods, tick each method this app should offer.
  3. Press Update.

Methods in the same sheet, under "Select the methods you want to enable for this client ID", with both boxes ticked and highlighted as step 2: Email/Password and Magic link

Each app keeps its own list, so a staff app can offer only Google while the customer app offers email and password too.

Check the preview

Open the Branding page. The settings for the page are on the left, and the Preview is on the right. It follows your name, logo, colours and words as you type, before you save, and switches between Sign in, Sign up and Forgot password, Light and Dark, and Desktop and Phone.

The Branding page, with Branding highlighted under Access: the page settings on the left, starting with Identity, and on the right a Preview of the sign-in card with choices for the screen, light or dark and desktop or phone, and an Open the live page for Acme Analytics button

Note

The preview draws the same sample card for every app: email and password, an Email me a link button and two sample providers, GitHub and Google. It does not read which methods your app has ticked. To see exactly what your users see, press Open the live page for Acme Analytics above it. That opens the real sign-in page in a new tab, with what is saved.

What people see

This is the real sign-in page for Acme Analytics with Email and password and Magic link ticked. The title uses the Name from the Branding page.

The hosted sign-in page for Acme Analytics: "Sign in to Acme", Email and Password fields, a Forgot password? link, a Sign in button, then "or" and an Email me a link button, and Create account at the bottom

On a phone the card fills the screen.

The same sign-in page on a phone: the card fills the width of the screen, with the same fields and buttons one under another

Test with a test account

Try every change yourself before your users meet it. A test account is an ordinary account in your app, made with an address you can read.

  1. On the Settings tab, press Test beside Acme Analytics.
  2. Under Choose a redirect URL to test, tick the address to come back to.
  3. Press Test session login. Your sign-in page opens in a new tab, the same way your app's Sign in button opens it. If nothing opens, allow pop-ups for the console in your browser.

The Test flow sheet for Acme Analytics: http://localhost:3000/callback is ticked under Choose a redirect URL to test and highlighted as step 2, and the Session login box has the Test session login button, highlighted as step 3, that opens the sign-in page in a new tab

  1. Press Create account and sign up with an address of yours, then sign in the way your users will.
  2. After signing in, the page sends you to the redirect URL you ticked. If your app is not running at that address yet, the browser shows that it cannot reach the page. That is expected: the sign-in itself worked.
  3. Open Users under User management. The test account is in the list. To remove it, open it and press Delete, then Delete user now.

Use a new private browser window for each test, so a device you trusted in an earlier test does not skip a step.

Testing in a development or staging environment

In a development or staging environment, Google and GitHub sign-in work with nothing to register: they go through apps BuildBase holds for every environment. The first time you use an environment, BuildBase adds a Google (BuildBase shared app) and a GitHub (BuildBase shared app) method to it and ticks them on the environment's own client, once BuildBase has each app set up. Production never shows this and never uses the shared apps: there you add your own Google or GitHub app, as the Google and GitHub guides show. Environments in the console says how to open one.

Open the Methods tab in the console

(opens the console in a new tab)
  1. Switch to the environment, then open the Methods tab. Above Login methods, the Shared sign-in for testing card lists each shared app and where this environment stands with it: Added, Not added, Using your own app or Not set up by BuildBase yet.

The Shared sign-in for testing card in a staging environment, its title highlighted as step 1: Google (BuildBase shared app) and GitHub (BuildBase shared app), both Added

  1. Removed one under Login methods? Its row reads Not added. Press Add on it to bring it back under its fixed name. It is ticked on the environment's own client at once, so its sign-in page shows it.

The GitHub (BuildBase shared app) row reading Not added, with its Add button highlighted as step 2

  1. To test with your own Google or GitHub app instead, press the edit button on its row under Login methods. The sheet says the method is On BuildBase's shared app. Enter your own app's credentials there and save: the row becomes yours, and the card reads Using your own app.

Login methods in a staging environment: the GitHub and Google rows, each titled as a BuildBase shared app, with the edit button on the Google row highlighted as step 3

While a row uses BuildBase's app, its name is fixed (Set by BuildBase while this method uses its shared app) and the consent screen names BuildBase, not your app. Entering your own credentials lets you rename it.

The SDK in your app

Your developers connect your app's code once. The console's How to connect your app guide names the three values it needs:

ValueWhere it goesSecret?
Organization IDNEXT_PUBLIC_BUILDBASE_ORG_ID, read as orgIdNo
Client IDNEXT_PUBLIC_BUILDBASE_CLIENT_ID, read as auth.clientIdNo
Client secretBUILDBASE_CLIENT_SECRET, on your server onlyYes
app/providers.tsx
import { ApiVersion, SaaSOSProvider, useSaaSAuth } from '@buildbase/sdk/react';

export function Providers({ children }: { children: React.ReactNode }) {
  return (
    <SaaSOSProvider
      serverUrl="https://api.console.buildbase.app"
      version={ApiVersion.V1}
      orgId={process.env.NEXT_PUBLIC_BUILDBASE_ORG_ID!}
      auth={{
        clientId: process.env.NEXT_PUBLIC_BUILDBASE_CLIENT_ID!,
        redirectUrl: 'https://app.acme.example/callback',
        callbacks: {
          // Your server swaps the code for a session with the client secret.
          handleAuthentication: async (code) => {
            const res = await fetch('/api/auth/token', {
              method: 'POST',
              body: JSON.stringify({ code }),
            });
            return { sessionId: (await res.json()).sessionId };
          },
        },
      }}
    >
      {children}
    </SaaSOSProvider>
  );
}

export function SignInButton() {
  const { signIn } = useSaaSAuth();
  return <button onClick={() => signIn()}>Sign in</button>;
}

The redirectUrl must be one of the app's Redirect URLs. The server route that swaps the code for a session is in Going to Production, and the full setup in the Quickstart.

Things to watch out for

  • The client secret is shown once. Copy it when you create the app. If it is lost, Regenerate in the app's Edit sheet makes a new one, and your server needs the new one.
  • A redirect URL is compared letter for letter. https://app.acme.example/callback and https://app.acme.example/callback/ are two different addresses. Only an address with no path and the same address ending in / count as one.
  • A * stands for exactly one part of the address. https://*.app.acme.example/callback lets in https://eu.app.acme.example/callback, but not https://app.acme.example/callback or https://a.eu.app.acme.example/callback. The https://, the port and the path still have to match.
  • A method you add does nothing until it is ticked on the app. Adding it on the Methods tab is not enough, and each app keeps its own list.
  • The preview is a sample card. It always shows email and password, Email me a link, GitHub and Google. Check your real methods with Open the live page or Test.
  • Most methods need an email sender. Without one, codes, links and password resets are refused with "Email sign-in is unavailable for this organization."
  • A device you trusted skips steps. Test in a new private window each time, or a device you trusted earlier can hide a two-step code from you.

Every guide in this section

GuideWhat it is forWhat you need for it
Email and passwordSign-in with an email address and a password, with forgot password and email verificationAn email sender
Sign-in links and email codesSign-in without a password, from a link or a 6-digit code sent by emailAn email sender
UsernamesA short name people can type instead of their email on the password formThe Email and password method
Who can sign upOpen sign-up, invite-only, an allowlist, a blocklist, a waitlist you approve, and no throwaway inboxesNothing else
Bot protectionA Cloudflare Turnstile check that a person, not a script, is signing up or asking for a codeNothing on the BuildBase sign-in address; a free Cloudflare account on your own domain
GoogleA Continue with Google buttonA Google Cloud project and its OAuth client
GitHubA Continue with GitHub buttonA GitHub OAuth app
MicrosoftA Continue with Microsoft button, for work, school and personal accountsAn app registration in Microsoft Entra
LinkedInA Continue with LinkedIn buttonA LinkedIn developer app
AppleA Continue with Apple buttonA paid Apple Developer Program membership
LovableA Continue with Lovable button, for people who build with LovableAn OAuth client registered by a Lovable workspace owner or admin
VercelA Continue with Vercel button, for people who build with Vercel or v0An App in your Vercel team's settings
Custom OIDC providerOne button for a provider BuildBase has not built, such as Keycloak or your company's ownAn OpenID Connect or OAuth 2.0 provider, and a plan with custom OIDC
Enterprise SSOContinue with SSO for the companies you sell to, each through its own identity providerYour own WorkOS account, and a plan with Enterprise SSO
Enterprise directory syncA company's people created and removed by its own directoryEnterprise SSO set up, and Directory Sync on your plan
Enterprise roles and groupsA company's own roles and groups, and roles from WorkOSEnterprise SSO set up for the company
Enterprise access policyHow long a company's people stay signed in, their addresses, break-glass people and sign-outEnterprise SSO set up for the company
Enterprise activity and streamsA company's activity, insights and log streams to its SIEMEnterprise SSO set up for the company
Enterprise API and agentsService accounts, API keys, workloads and agents for a companyEnterprise SSO set up for the company
Google One TapGoogle's small box that signs people in with the Google account already in their browserThe Google method set up
Keep your sign-inAn app that already signs people in with Supabase, Clerk, Auth0, Firebase or its own codeNothing: it lays out the three paths before you change anything
Importing usersBringing your users from Clerk, Auth0, Firebase, Supabase or your own system, passwords includedAn export from the old system and an API token
PhoneSign-in with a 6-digit code by text message, WhatsApp or a voice callYour own SMS provider (Twilio, or a webhook), and a plan with phone codes
Two-step sign-inA second code from an authenticator app or a text message after the first stepNothing for the app; an SMS provider for text message codes
PasskeysSign-in with a fingerprint, a face or the screen lockA plan with passkeys
Account security screensWhat your users see inside your app: password, two-step, devices, connected accountsThe SDK in your app
Continue as guestTrying your app without an account, then keeping everything after signing upA plan with guest users, and sign-up open to anyone
Crypto walletsSign-in by signing a message with an Ethereum or Solana walletA plan with wallet sign-in
Device codeSign-in on a TV or in a command line tool, approved on a phone or computerAn OAuth 2.0 client with device code sign-in switched on, and a plan with the OAuth 2.0 server
Agents and other appsLetting AI agents and other companies' apps act for your users, with their consentThe Agent readiness tab
The sign-in pageYour name, logo, colours, layout, words and languages on the hosted pageYour logo and colours
Your own domainThe hosted sign-in page on an address you own, such as auth.acme.example, for every app or oneA plan with custom auth domains, and access to the domain's DNS
Signing in as a userSeeing your app as one of your users, to help with a support requestA console role that can create users and read auth settings
Sessions and devicesHow long a sign-in lasts, and signing one person out of a device or a sessionNothing else
Audit trailWho changed your sign-in setup, from which IP address, and what each change wasNothing else

Next steps