BuildBaseBuildBase

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.Authentication, Sign-in page tab
The live previewA picture of your sign-in page beside its settings, which follows your edits before you save.Sign-in page tab, 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 Sign-in page tab: 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

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, Sign-in page, Domains and Agent readiness.

The console with User management open in the menu and Authentication chosen under Access. Tabs across the top read Settings, Methods, Sign-up, Security, SMS, Sign-in page, Domains and Agent readiness, and the Settings tab lists one 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, open 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 an Add redirect URL button below

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, Magic link and Email/Password, with an Add auth method button

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, Google, LinkedIn, GitHub, Microsoft, Apple and Custom OIDC provider), and under them what the chosen one, 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: Magic link, and Email and password

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 Sign-in page tab. 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 Sign-in page tab: 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 Sign-in page tab.

The hosted sign-in page for Acme Analytics: "Sign in to Acme Analytics", 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 the Session login box has a Test session login button 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.

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
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/verify', {
              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
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
Google One TapGoogle's small box that signs people in with the Google account already in their browserThe Google method set up
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 page, and your own domainYour logo and colours
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

Next steps