MDK Logo

Auth

Authentication and sign-in components

Components for authentication flows and user sign-in.

Prerequisites

  • Install the packages
npm install \
  @tetherto/mdk-react-devkit \
  @tetherto/mdk-react-adapter \
  @tetherto/mdk-ui-foundation
  • Import styles: import '@tetherto/mdk-react-devkit/styles.css'

Components

@tetherto/mdk-react-devkit

Import the public APIs on this page from @tetherto/mdk-react-devkit.

RequireAuth

Route guard that reads the session token from the headless authStore (via useAuth) and renders the children only when a token is present. Otherwise it renders fallback — typically <Navigate to="/signin" replace /> from react-router. Router-agnostic by design

agent-ready

Source

src/domain/components/auth/require-auth/USAGE.md

src/domain/components/auth/require-auth/require-auth.tsx

Props

PropStatusType / OptionsDefaultDescription
childrenRequiredReact.ReactNode-Rendered when a token is present
fallbackRequiredReact.ReactNode-Rendered when no token is present — typically <Navigate to="/signin" />
rememberPathOptionalbooleantrueWhen true (default), the current location is persisted to sessionStorage before rendering the fallback so the sign-in flow can return there

SignInGoogleButton

One-click Google OAuth sign-in trigger. Defaults to a full-page redirect to ${oauthBaseUrl}/oauth/google, the Gateway's Google sign-in route

agent-ready

Source

src/domain/components/auth/sign-in-google-button/USAGE.md

src/domain/components/auth/sign-in-google-button/sign-in-google-button.tsx

Props

PropStatusType / OptionsDefaultDescription
oauthBaseUrlRequiredstring-Base URL of the OAuth backend (no trailing slash). Click navigates to ${oauthBaseUrl}/oauth/google
contentClassNameOptionalstring-Class names applied to the inner content wrapper
disabledOptionalbooleanfalseDisable the button
fullWidthOptionalbooleanfalseMake the button stretch to fill its container
iconOptionalReact.ReactNode-Icon node rendered alongside children
iconPositionOptional"left" | "right""left"Icon placement relative to children
labelOptionalstring"Sign in with Google"Override the visible button label
loadingOptionalbooleanfalseShow a spinner instead of the content and disable the button
onClickOptional(() => void)redirectOverride the click behaviour entirely. When set, oauthBaseUrl is ignored
sizeOptional"sm" | "md" | "lg"-Size token (sm, md, lg)
typeOptional"button" | "submit" | "reset""button"Native button type
variantOptional"icon" | "link" | "primary" | "danger" | "secondary" | "tertiary" | "nav-link" | "outline" | "ghost""secondary"Visual variant (e.g. primary, secondary, ghost)

On this page