Skip to main content

Documentation Index

Fetch the complete documentation index at: https://stackauth-e0affa27-chore-move-mcp-to-a-sep-app.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

This is a detailed reference for the StackApp object. If you’re looking for a more high-level overview, please read the respective page in the Concepts section.

Overview


StackClientApp

A StackApp with client-level permissions. It contains most of the useful methods and hooks for your client-side code. Most commonly you get an instance of StackClientApp by calling useStackApp() in a Client Component.

Table of Contents

type StackClientApp = {
  new(options): StackClientApp;

  getUser([options]): Promise<User>;
  useUser([options]): User;
  getProject(): Promise<Project>;
  useProject(): Project;

  signInWithOAuth(provider): void;
  signInWithCredential([options]): Promise<...>;
  signUpWithCredential([options]): Promise<...>;
  sendForgotPasswordEmail(email): Promise<...>;
  sendMagicLinkEmail(email): Promise<...>;
};

Constructor

Creates a new StackClientApp instance. Because each app creates a new connection to Stack Auth’s backend, you should re-use existing instances wherever possible.
This object is not usually constructed directly. More commonly, you would construct a StackServerApp instead, pass it into your app setup (see the setup guide), and then use the useStackApp() hook to obtain a StackClientApp.The setup wizard does these steps for you, so you don’t need to worry about it unless you are manually setting up Stack Auth.If you’re building a client-only app and don’t have a SECRET_SERVER_KEY, you can construct a StackClientApp directly.

User Management

stackClientApp.getUser([options])

stackClientApp.useUser([options])

stackClientApp.getProject()

stackClientApp.useProject()

Authentication

stackClientApp.signInWithOAuth(provider)

stackClientApp.signInWithCredential([options])

stackClientApp.signUpWithCredential([options])

stackClientApp.sendForgotPasswordEmail(email)

stackClientApp.sendMagicLinkEmail(email)


StackServerApp

Like StackClientApp, but with server permissions. Has full read and write access to all users.
Since this functionality should only be available in environments you trust (ie. your own server), it requires a SECRET_SERVER_KEY. In some cases, you may want to use a StackServerApp on the client; an example for this is an internal dashboard that only your own employees have access to. We generally recommend against doing this unless you are aware of and protected against the (potentially severe) security implications of exposing SECRET_SERVER_KEY on the client.

Table of Contents

type StackServerApp =
  // Inherits all functionality from StackClientApp
  & StackClientApp
  & {
    new(options): StackServerApp;

    getUser([id][, options]): Promise<ServerUser | null>;
    useUser([id][, options]): ServerUser;
    listUsers([options]): Promise<ServerUser[]>;
    useUsers([options]): ServerUser[];
    createUser([options]): Promise<ServerUser>;
    sendEmail(options): Promise<Result<void, KnownErrors>>;

    getTeam(id): Promise<ServerTeam | null>;
    useTeam(id): ServerTeam;
    listTeams(): Promise<ServerTeam[]>;
    useTeams(): ServerTeam[];
    createTeam([options]): Promise<ServerTeam>;
  }

Constructor

Creates a new StackServerApp instance.

User Operations

stackServerApp.getUser([id], [options])

stackServerApp.useUser([id], [options])

stackServerApp.listUsers([options])

stackServerApp.useUsers([options])

stackServerApp.createUser([options])

stackServerApp.sendEmail(options)

Team Management

stackServerApp.getTeam(id)

stackServerApp.useTeam(id)

stackServerApp.listTeams()

stackServerApp.useTeams()

stackServerApp.createTeam([options])