Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .agents/skills/kitcn/references/features/auth.md
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ All from `kitcn/react`:
| `useMaybeAuth()` | `boolean` | Has token (optimistic, may not be verified) |
| `useIsAuth()` | `boolean` | Server-verified authentication |
| `useAuthGuard()` | `() => boolean` | Guard mutations, returns true if blocked |
| `useConvexAuthRecovery()` | `{ recover, status, error }` | Rebind Convex auth after a transient token failure |

### useAuthGuard

Expand Down Expand Up @@ -409,6 +410,28 @@ import { ConvexProviderWithAuth } from 'kitcn/react';
<ConvexProviderWithAuth client={convex} useAuth={useAuthFromConvexDev}>
```

### Convex Auth Recovery

Use recovery only when the outer auth provider remains authenticated but
Convex entered an unauthenticated state after a transient token refresh
failure:

```tsx
import { useConvexAuthRecovery } from 'kitcn/react';

const { error, recover, status } = useConvexAuthRecovery();
await recover();
```

`recover()` replaces the provider-owned auth binding and resolves after Convex
confirms authentication. Concurrent calls share one promise. The default
timeout is 10 seconds; override it with `recover({ timeoutMs })`.

Failures are `ConvexAuthRecoveryError` values with code
`AUTH_PROVIDER_LOADING`, `AUTH_PROVIDER_UNAUTHENTICATED`,
`AUTH_RECOVERY_CANCELLED`, `AUTH_RECOVERY_FAILED`, or
`AUTH_RECOVERY_TIMEOUT`. Never recover an intentional sign-out.

---

## Auth Triggers
Expand Down
7 changes: 0 additions & 7 deletions .changeset/brave-cats-recover.md

This file was deleted.

4 changes: 2 additions & 2 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions packages/kitcn/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# kitcn

## 0.15.16

### Patch Changes

- [#301](https://github.com/udecode/kitcn/pull/301) [`3248105`](https://github.com/udecode/kitcn/commit/32481058f1043a4f9a0a897ee966d9048dc79739) Thanks [@zbeyens](https://github.com/zbeyens)! - ## Features

- Add provider-owned Convex authentication recovery after transient token failures.

## 0.15.15

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/kitcn/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kitcn",
"version": "0.15.15",
"version": "0.15.16",
"description": "kitcn - React Query integration and CLI tools for Convex",
"keywords": [
"convex",
Expand Down
2 changes: 2 additions & 0 deletions packages/resend/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# @kitcn/resend

## 0.15.16

## 0.15.15

## 0.15.14
Expand Down
2 changes: 1 addition & 1 deletion packages/resend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kitcn/resend",
"version": "0.15.15",
"version": "0.15.16",
"description": "kitcn Resend plugin",
"type": "module",
"sideEffects": false,
Expand Down
Loading