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
npm install @authdog/remix-nodeRequires @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:
// 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:
// 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:
// app/routes/logout.ts
import { logoutLoader } from "@authdog/remix-node"
export const loader = logoutLoaderPair the loader-resolved session with your authorization model to decide what a user may do.
Next steps
- Component reference — the
@authdog/react-elementsUI (e.g.UserProfile). - Backend requests — the verification model, in depth.
- Quickstarts — the five-minute path.