Rising Tide Developers
UI PackageAuth

Auth

The @rising-tide/ui/auth entry point - auth providers, AuthGate, and user identity.

@rising-tide/ui/auth provides authentication components and providers. Most apps never mount them directly: RisingTideProviders composes the whole stack, and this entry point is what you import to read from it.

Key exports

import {
  RisingTideAuthProvider,  // Lower-level auth composition (see below)
  AuthGate,                // Route guard component
  AuthenticationChoice,    // The sign-in choice: hosted account, or your own wallet
  SignOutButton,           // Logout component
  useProtocolUser,         // Hook: current user + entitlements (via hasEntitlement)
  useEntitlement,          // Hook: shorthand for useProtocolUser().hasEntitlement(name)
} from "@rising-tide/ui/auth";

Provider setup

Prefer RisingTideProviders. If you compose the stack yourself, RisingTideAuthProvider takes the app's SDK client and a ProtocolUserConfig, and must sit inside PrivyProvider (from @privy-io/react-auth - see Privy):

<PrivyProvider appId={process.env.NEXT_PUBLIC_PRIVY_APP_ID!}>
  <RisingTideAuthProvider
    sdk={rtClient}
    userConfig={{
      storagePrefix: "myapp",
      linkInviteCodes: true,
      onSignupComplete: () => {},
    }}
  >
    {children}
  </RisingTideAuthProvider>
</PrivyProvider>

The three userConfig members shown are the required ones. See Provider Setup for what this path leaves out.

Hooks on this entry point

// The invite code in flight
useInviteCode()

// Which path the user signed in by
useAuthMethod()

useInviteCode is in eight apps, more than any other hook in the package except useTheme. The invite code is transport, not state: a /claim/<code> deep link stashes it in session storage, signup consumes it, and it is cleared on signup and on sign-out. Read it to decide what a sign-in surface should say, never to decide whether somebody may act - that answer is useProtocolUser().requiresInvite, which comes from the server.

useAuthMethod says whether the session is a hosted account or a connected wallet. It matters because the two sign transactions differently: a hosted account goes through rtClient.privy, a connected wallet signs in the browser.

In this section