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

# Storing users

If you use [Bijection Auth](https://docs.bijection.com/access/authentication/providers/bijection-auth#your-users),
its `createUser` callback inserts your app's user fact during first sign-in.
With any provider you can keep the record yourself, keyed by the caller's
`PrincipalId`.

```ts theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
import { app, mutation, query, role, t, table } from "@bijectionhq/bijection";

export const profiles = table({ subject: t.principal, name: t.string }, { key: ["subject"] });

export const saveProfile = mutation(
  { allow: [role.signedIn], args: { name: t.string } },
  (ctx, { name }) => ctx.put(profiles(ctx.frame.as.id), { name }),
);

export const myProfile = query({ allow: [role.signedIn] }, (ctx) => ctx.get(profiles(ctx.frame.as.id)));

export default app({ profiles, saveProfile, myProfile });
```

`ctx.put` makes the fact be this blind, so a first save and a later one are
the same call. Use `ctx.insert` instead when a second creation must refuse
`Exists`.

The profile is application data. It gives the caller no role: roles come
from [grants](https://docs.bijection.com/access/grants.md).


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