Skip to Content

XAppHub

Add single sign-on to your app, backed by XAppHub.

On a Buildpad Engine project, the connector is available only when the project runs a recent data service version. The sign-in works differently there. See How the Sign-In Works.

What is XAppHub?

XAppHub is an OIDC identity provider — a separate app in your workspace, not a Microsoft product. It issues standard OAuth2/OIDC tokens (authorization code + PKCE), so your generated app can add “Sign in with XAppHub” without you writing any IDP-specific code. On a Buildpad Engine project, your coding assistant’s add-external-oauth skill builds the sign-in with the CLI’s external-oauth-engine module. The same add-external-oauth skill your coding assistant already uses for Azure AD, Google, Okta, and Auth0 handles XAppHub too.

Perfect for:

  • Adding SSO login without registering an OAuth client by hand
  • Keeping every generated app’s login on one shared identity provider
  • Skipping the manual “copy client_id, paste client_secret” round trip most OIDC providers require
  • Sessions issued by your project’s Engine, with no Engine secret in your app Multi-provider login pages that offer XAppHub alongside Azure/Google/Okta

Do not confuse XAppHub with Microsoft’s “My Apps” portal (myapplications.microsoft.com), part of Entra ID/Azure AD app assignment. They are unrelated products — if you want XAppHub, say so explicitly, or just connect it here first and let your assistant find it automatically (see Step 2).

What You’ll Need

XAppHub, connected

Auto-provisioned automatically, or bring your own Client ID/Secret — see Step 1.

Nothing else

Auto-provision registers everything XAppHub needs in one call.

Step 1: Connect XAppHub

Connect the project

  1. Open your project → Connectors in the sidebar (or check the XAppHub card during project creation).
  2. Click Connect.
  3. Choose a mode:
    • Auto-provision (default) — Buildpad registers an OIDC client with XAppHub on your behalf, named {your org name} - {your project name} ({first 8 characters of the project id}), with both your deployed app’s callback URL and http://localhost:3000/api/auth/callback (for local dev) already registered as redirect URIs. From the Connectors page, the registration runs while you wait, then the card shows Connected. If you selected XAppHub on the create form, the card shows Auto-configuring until the project is ready, then Connected. If XAppHub already has a client with that name, the registration fails with XAppHub already has a client named "…", so a new one could not be registered. On the Connectors page, the dialog shows this message. The card shows Error with the message after the page reloads, or at once when the create form set up the connector. Delete that client in XAppHub (Admin, IDP clients). Then click Auto-provision now again. If the dialog is closed, click Retry on the card first.
    • Bring your own key — paste an existing XAppHub Client ID and Client Secret. Use this if you already registered a client yourself through the XAppHub admin UI.
  4. For Auto-provision, click Auto-provision now. For Bring your own key, click Connect.

Auto-provisioning stores seven values for your project: OAUTH_CLIENT_ID, OAUTH_CLIENT_SECRET, and five fixed OIDC endpoint URLs (OAUTH_AUTHORIZATION_URL, OAUTH_TOKEN_URL, OAUTH_USERINFO_URL, OAUTH_JWKS_URI, OAUTH_ISSUER) — all pointed at the XAppHub instance for this environment. These are exactly the env var names the add-external-oauth skill’s “Generic / Custom OIDC Provider” config expects, so no mapping step is needed. When you disconnect the connector, or delete the project or its organization, Buildpad also deletes the client that auto-provisioning registered in XAppHub. If that deletion fails, the disconnection or the project deletion still completes. A client that you registered yourself and pasted in stays in XAppHub.

If you’re bringing your own credentials

  1. Open the XAppHub admin UI (the globe icon, Open XAppHub SSO, on the connector card).
  2. Register a new IDP client, giving it your app’s redirect URI(s) — the deployed callback URL, plus http://localhost:3000/api/auth/callback if you’ll test locally.
  3. Copy the Client ID and Client Secret it gives you, and paste them into the connect form.

With Bring your own key, Buildpad registers no redirect URIs. You register each redirect URI in the XAppHub admin UI yourself. Auto-provision registers only two redirect URIs: your deployed app’s callback URL (https://main.{Amplify default domain}/api/auth/callback) and http://localhost:3000/api/auth/callback. In both modes, if you add a custom domain or use a different local port later, add {that origin}/api/auth/callback in the XAppHub admin UI yourself.

Step 2: Tell the Agent What You Want

Once XAppHub is connected, your coding assistant already knows how to reach it — you don’t need to paste a client ID, secret, or any URLs into a prompt.

Example 1: Basic SSO login

Create an SSO feature that uses the IDP from XAppHub.

Example 2: Login page with two options

Add a login page with two options: "Sign in with XAppHub" and the existing email and password sign-in.
Add a login page with two options: "Sign in with XAppHub" and "Sign in with Google". Let me pick which providers show based on a `providers` prop, like the existing OAuthLoginButtons component supports.

Example 3: Redirect after login

After signing in with XAppHub, redirect the user to /dashboard instead of the homepage. If they were trying to reach a specific page before being sent to log in, return them there instead.

Under the hood: On a Buildpad Engine project, the add-external-oauth skill first checks that the my-apps connector is connected. There is no manual fallback: if the connector is not connected, the skill tells you to connect XAppHub on the Connectors page and stops. When it is connected, the skill installs the CLI’s external-oauth-engine module. See How the Sign-In Works. On a Supabase project, the add-external-oauth skill’s Step 0 looks for a connected connector whose env vars include OAUTH_CLIENT_ID before doing anything else. If it finds one, it uses those values directly; only if none exists does it fall back to asking you to register a client and paste credentials by hand.

Step 3: Test the Connection

Start the app

Run pnpm dev and open the login page.

Confirm the button appears

A “Sign in with XAppHub” (or similarly labeled) button should render.

Click through the flow

You should be redirected to XAppHub, prompted to authenticate, then redirected back and logged in.

Check for a session

After redirecting back, you should be signed in — no login loop back to the sign-in page. On a Buildpad Engine project, you hold an Engine session.On a Supabase project, you are an authenticated Supabase user.

Check the user can actually use the app

Test with a brand-new XAppHub account, not one that already has a role.

On a Buildpad Engine project, the app gives no role. A first sign-in creates an account with no role, unless a starting role is set (below). The app ends that session and opens /auth/pending-access, which tells the user to sign in again when they have access. Give the new user a role in the Studio, then sign in again.

A starting role. You can have the Engine give new XAppHub accounts one role on their first sign-in, when their verified email is in domains you list (example.com does not cover mail.example.com). Ask your coding assistant to set it with the Engine’s external-sign-in MCP tool, naming a role that is not an administrator’s role. Only new accounts get it; existing accounts keep their roles. Confirm with XAppHub’s owner that XAppHub checks an address’s domain, since the list is only as strong as that check.

First-time SSO users are created on the fly (JIT provisioning), and they must also be assigned your app’s default role during that first login — a user with no role is denied everything by the permissions system, so login effectively fails even though XAppHub authenticated them. See Logged In, but Everything Is Denied if this happens.

Repeat after deploying

Env vars connected here don’t automatically reach your deployed app — ask your assistant to push them (see Something Not Working?) and re-test on the live URL.

How the Sign-In Works

On a Buildpad Engine project, the Engine checks the XAppHub ID token itself and issues its own session. The app holds no Engine secret, and the Engine holds no XAppHub secret.

  • When it is available. The connector shows on the project’s Connectors page only when the project runs a recent data service version. A new Engine release does not hide it.
  • On the create form. The create form offers the connector for a Buildpad Engine project. If you select it, the connector shows Auto-configuring while the project is created. When the project is ready, Buildpad registers the client and records it at the Engine. If the project’s version is too old, the connector shows Error with “Connector ‘my-apps’ needs a newer Data_Service_Version for an Engine project”. If a step fails, the connector shows Error with the reason. Select Retry on the Connectors page.
  • What connecting does. The platform registers the client at XAppHub, as for a Supabase project. Then it records the client ID at the project’s Engine, so that the Engine accepts ID tokens for this client. The Engine never receives the client secret. If the Engine is stopped or cannot be reached, the connector shows Error with the reason. Start the project, then select Retry.
  • One client, one project. A client ID that another project uses is refused with “This XAppHub client is connected to another project”.
  • How the app signs a user in. The app’s server-side callback route does the code exchange with XAppHub. Then it calls the Supabase client’s signInWithIdToken({ provider: 'my-apps', token, nonce }) with the ID token and the raw nonce. The route sent the SHA-256 hex digest of that nonce to XAppHub. The app uses no service-role key, no magic link or one-time code, and writes no role.
  • New users have no role. A user’s first sign-in creates an account that holds no role, unless a starting role is set. The account reads only what the project grants every caller. The app ends a session that has no role and shows /auth/pending-access. Give the user a role in the Studio.
  • Refused accounts. The Engine refuses an account that holds a host role or administers the project’s tenant. It also refuses an account that already exists with the same email but is not linked to this XAppHub identity. It also refuses a token that it does not trust, or an email that XAppHub does not mark as verified. The app shows one message (sign_in_refused) for all refusals. The message tells the user to sign in with their email and password if they have one.
  • Keep the secret on the server. OAUTH_CLIENT_SECRET stays in a server-side variable. Its name must not begin with NEXT_PUBLIC_.
  • Sign-out. Signing out through the Supabase client ends the Engine session. It does not end the user’s session at XAppHub.
  • XAppHub only. On a Buildpad Engine project, XAppHub is the only external sign-in. Other providers, such as Google or Azure AD, are not available.
  • With customers. On a project with customers, people sign in at each customer’s own address once the project confirms that the app finds the customer from the address. See XAppHub sign-in.
  • Disconnecting. The platform removes the client ID from the Engine first. After that, no user can sign in with that client. If the removal fails, the connector stays in Error, and you can disconnect again.

On a Supabase project, the add-external-oauth skill builds the sign-in with the seven values that the connector stores. After the sign-in, the user is an authenticated Supabase user. First-time users are created on the fly, and they must get your app’s default role during that first login. See Logged In, but Everything Is Denied.

Common Questions

Do I need to register a redirect URI myself?

No, not with auto-provision — when the connector is provisioned, Buildpad registers two redirect URIs: your deployed app’s callback URL (https://main.{Amplify default domain}/api/auth/callback) and http://localhost:3000/api/auth/callback. Register any other URL yourself in XAppHub, for example a custom domain or a different local port. With Bring your own key, you register every redirect URI yourself.

What if my local dev server doesn’t run on port 3000?

The auto-provisioned redirect URI assumes the Next.js default (localhost:3000, no port override). If your generated app runs on a different port, register that redirect URI with XAppHub yourself, or switch back to the default port for local testing.

Can I tell my assistant “use XAppHub” without it defaulting to Azure AD?

Yes — as long as XAppHub is connected on the Connectors page first, your assistant checks there before considering any other provider, regardless of how you phrase the request.

Can I offer XAppHub alongside another provider, not instead of it?

On a Buildpad Engine project, no. XAppHub is the only external provider.

On a Supabase project, yes — OAuthLoginButtons renders one button per configured provider, so connecting XAppHub doesn’t replace an existing Azure AD/Google/Okta/Auth0 setup. See Example 2 above.

Something Not Working?

Can’t Connect

Tell the agent:

Getting an error calling XAppHub. Can you check: 1. OAUTH_CLIENT_ID and OAUTH_CLIENT_SECRET are set in .env.local 2. The connector shows "Connected" on the project's Connectors page 3. Whether I need to restart `pnpm dev` after adding the env vars

Redirects to XAppHub, Then Fails

Tell the agent:

I get redirected to XAppHub and can log in, but the callback fails (or I end up back on the login page). Can you check: 1. Whether the redirect URI XAppHub has registered actually matches this app's callback route 2. Whether the callback route calls supabase.auth.signInWithIdToken() with provider 'my-apps', the ID token and the raw nonce, and sent the SHA-256 hex digest of that nonce to XAppHub
I get redirected to XAppHub and can log in, but the callback fails (or I end up back on the login page). Can you check: 1. Whether the redirect URI XAppHub has registered actually matches this app's callback route 2. Whether the session is being set with supabase.auth.setSession(), not manual cookie setting

Logged In, but Everything Is Denied

New SSO users authenticate fine but see no data, get permission errors, or bounce straight back to the login page.

On a Buildpad Engine project, this is expected for a new user: the account holds no role until you give it one in the Studio.

Tell the agent:

SSO login with XAppHub succeeds, but a newly provisioned user can't access anything afterwards. Can you check: 1. Whether the JIT-provisioned user has a role in DaaS — without a role, the permissions system denies every request 2. That OAUTH_DEFAULT_ROLE_ID is set (locally and in Amplify) to a valid non-admin role UUID, and that the OAuth callback assigns it on first login 3. That the default role has policies granting the collections the app needs

Works Locally, Not After Deploying

Tell the agent:

XAppHub login works with `pnpm dev` but not on the deployed app. Can you check whether OAUTH_CLIENT_ID, OAUTH_CLIENT_SECRET, and the OAUTH_* endpoint URLs are set in the Amplify environment, and redeploy if you add or change any of them?

Assistant Suggests Azure AD Instead of XAppHub

Tell the agent:

I asked for SSO via XAppHub but you configured Azure AD/Entra ID instead. Can you check the Connectors page for a connected connector whose env vars include OAUTH_CLIENT_ID, and use that instead of assuming which provider I meant?

Real Examples

Example: Internal admin tool, XAppHub only

This is an internal tool — restrict login to XAppHub only, no email/password fallback. Hide any other sign-in options on the login page.

On a Buildpad Engine project, keep password sign-in for the project’s administrators: the Engine refuses XAppHub sign-in for an account that administers the project. Ask for the password form to stay reachable, for example at a separate admin sign-in page.

Example: Role-based redirect after login

After signing in with XAppHub, check the user's role and send admins to /admin and everyone else to /dashboard.

Advanced Features

Once the basics work:

Forcing re-authentication

I want a "Switch account" link that forces XAppHub to show the login prompt again, even if the user has an active XAppHub session.

This uses the OAUTH_AUTH_PARAMS env var (a JSON object of extra authorization params, e.g. {"prompt":"login"}) that add-external-oauth already supports for any OIDC provider, including XAppHub.

Custom redirect target after login

Store a "returnTo" URL before sending the user to XAppHub, so they land back on the exact page they started from instead of the homepage.

Quick Checklist

Before going live:

  • Connector shows Connected on the Connectors page
  • Login button renders and redirects to XAppHub
  • Feature works with pnpm dev locally
  • Env vars pushed to the Amplify deployment and redeployed
  • New SSO users get the app’s default role automatically (OAUTH_DEFAULT_ROLE_ID set locally and in Amplify) Each new SSO user has a role, given in the Studio
  • Tested the full login flow on the live URL with a brand-new XAppHub account — and confirmed that user can actually reach the app’s pages, not just get a session
  • Checked what happens if the user cancels or denies at the XAppHub login screen

Remember

Auto-provision skips the manual round trip — no registering a client by hand, no copying a client_id/secret back and forth.

XAppHub is this IDP, not Microsoft’s “My Apps” portal — connect it on the Connectors page and your assistant will find it without needing that spelled out every time.

Local dev is handled too — http://localhost:3000/api/auth/callback is registered alongside your deployed URL automatically.

Deploying is a separate step — connecting XAppHub doesn’t push env vars to your live app automatically.

SSO alone doesn’t grant permissions — first-time users are provisioned on the fly, and they need your app’s default role assigned during that first login or the permissions system denies them everything. with no role, so they read only what the project grants every caller until you give them a role in the Studio.

Stuck? Tell your coding assistant: “I need help with the XAppHub integration” and describe the issue.

Last updated on