Buildspace
Authentication

Client SDK

Browser-side auth URL generation methods.

import { createClient } from "@buildspacestudio/sdk/client";

const bs = createClient(process.env.NEXT_PUBLIC_BUILDSPACE_PUBLISHABLE_KEY!);

Methods

getSignInUrl(options)

Returns a URL string pointing to the Buildspace hosted login page. Redirect the user here to start the sign-in flow.

const url = bs.auth.getSignInUrl({ redirectUri: "/api/callback" });

getSignUpUrl(options)

Returns a URL string pointing to the Buildspace hosted sign-up page.

const url = bs.auth.getSignUpUrl({ redirectUri: "/api/callback" });

Parameters

ParameterRequiredDescription
redirectUriYesURL to redirect to after auth completes
appSlugNoTarget a specific app by slug for multi-app setups
envNo"dev" or "prod" to control which environment the auth flow targets

How it works

The client SDK generates URLs that redirect users to the Buildspace hosted login app, which is powered by Better Auth. Users can authenticate via email + password or email OTP. After successful auth, users are redirected back to your redirectUri with an authorization code that your server exchanges for a session token.

For the full auth flow, see the Overview.

On this page