Authdog

Remix

Last updated Jul 11, 2026
View as Markdown

The @authdog/remix-node SDK integrates Authdog with Remix: a client provider plus server loaders that resolve the session and exchange the sign-in token into HttpOnly cookies. It reads the session Authdog issues.

Install

Bash
npm install @authdog/remix-node

Requires @remix-run/node ^2.15+ and React 18 or 19. Set PK_AUTHDOG (your pk_... key) on the server.

Wrap the app

AuthdogProvider and ReloadPage capture the ?token= from the sign-in redirect, let the server set HttpOnly cookies, and strip the token from the URL:

TSX
// app/root.tsx
import { AuthdogProvider, ReloadPage } from "@authdog/remix-node/client"

export default function App() {
  return (
    <AuthdogProvider>
      <Outlet />
      <Scripts />
      <ReloadPage />
    </AuthdogProvider>
  )
}

Resolve the session in a loader

identityLoader() returns a Remix loader that verifies the session server-side and returns { user } — the enforcement point:

TSX
// app/routes/profile.tsx
import { useLoaderData } from "@remix-run/react"
import { identityLoader } from "@authdog/remix-node"

export const loader = identityLoader()

export default function Profile() {
  const { user } = useLoaderData<typeof loader>()
  return <UserProfile user={user} loading={false} />
}

Sign out

Wire a route to logoutLoader, which clears the session and redirects:

TypeScript
// app/routes/logout.ts
import { logoutLoader } from "@authdog/remix-node"
export const loader = logoutLoader

Pair the loader-resolved session with your authorization model to decide what a user may do.

Next steps