> ## Documentation Index
> Fetch the complete documentation index at: https://docs.theauth.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Solid

> Session accessors for Solid from `@glinr/theauth-client`, built on a framework-neutral session store with no solid-js dependency.

`@glinr/theauth-client` ships `createSessionStore` (plain state, subscribe, sign in and out) and `createSolidAuth`, which turns the store into Solid accessors. Pass in the two Solid primitives you already import. The client takes no dependency on `solid-js`, so it works with any 1.x release.

```bash theme={"dark"}
pnpm add @glinr/theauth-client solid-js
```

```typescript theme={"dark"}
// lib/auth.ts
import { createSignal, onCleanup } from "solid-js";
import { createSessionStore, createSolidAuth } from "@glinr/theauth-client";

const store = createSessionStore({
  basePath: "/api/theauth",
  storage: typeof localStorage === "undefined" ? undefined : localStorage,
});

export const { useSession, useUser, useIsAuthenticated } = createSolidAuth(
  { createSignal, onCleanup },
  store,
);
export { store };
```

```tsx theme={"dark"}
// components/Profile.tsx
import { store, useUser } from "../lib/auth";

export function Profile() {
  const user = useUser();
  return (
    <button onClick={() => store.signOut()}>
      {user()?.email ?? "Sign in"}
    </button>
  );
}
```

Call `store.refresh()` once on the client. It reads `GET {basePath}/auth/session` (cookie or stored bearer token) and shows a saved session while it waits. `store.signIn(identifier, password)` and `store.signUp(identifier, password, name)` post to `/auth/username/sign-in` and `/auth/username/sign-up` by default (`/auth/email/sign-in` and `/auth/email/sign-up` with `emailPassword: true`, see [Client SDK](/client-sdk)) and return `{ success: true }` or `{ success: false, error, code? }`. `store.signOut()` clears local state, then revokes the session with `POST {basePath}/auth/sign-out`. To refetch on focus or an interval, pass `refetch` to `createSessionStore`, see [Session refetch and SSR](/client-sdk#session-refetch-and-ssr). `createSolidAuth` also returns `refresh` and `hydrateSession`. The store uses `fetch` only, so it runs in browsers, workers and edge runtimes. Without a `storage`, the session lives in memory only.

## What was run

The `lib/auth.ts` code type checks under `strict` against solid-js 1.x types and runs under `createRoot` in Node. Store behavior is covered by `packages/client/tests/session-store-solid.test.ts`. No browser run of the JSX.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.