@neondatabase/auth 0.1.0-beta.11 → 0.1.0-beta.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -1
- package/dist/{adapter-core-Bw9mn_AS.d.mts → adapter-core-D1HVvYeG.d.mts} +162 -130
- package/dist/{adapter-core-C_NEMs0b.mjs → adapter-core-Ed-EN_tr.mjs} +162 -35
- package/dist/better-auth-react-adapter-C4kQ31os.d.mts +2194 -0
- package/dist/{better-auth-react-adapter-BbM3jLLv.mjs → better-auth-react-adapter-COSlFmvp.mjs} +1 -6
- package/dist/{chunk-5DLVHPZS-Bxj7snpZ-DoVNlsyk.mjs → chunk-5DLVHPZS-Bxj7snpZ-EhdAQJMu.mjs} +2 -2
- package/dist/index.d.mts +9 -3
- package/dist/index.mjs +1 -1
- package/dist/{neon-auth-DdlToh7_.mjs → neon-auth-BHWfv-bR.mjs} +4 -3
- package/dist/next/index.d.mts +45 -30
- package/dist/next/index.mjs +2 -2
- package/dist/react/adapters/index.d.mts +2 -2
- package/dist/react/adapters/index.mjs +1 -1
- package/dist/react/index.d.mts +2 -2
- package/dist/react/index.mjs +3 -3
- package/dist/react/ui/index.mjs +2 -2
- package/dist/react/ui/server.mjs +1 -1
- package/dist/supabase-adapter-BFja3Oys.d.mts +2280 -0
- package/dist/{supabase-adapter-CAqbpOC7.mjs → supabase-adapter-NVDAeWHu.mjs} +1 -11
- package/dist/ui/.safelist.html +1 -1
- package/dist/{ui-aMoA-9nq.mjs → ui-C1IRQzLY.mjs} +49 -49
- package/dist/vanilla/adapters/index.d.mts +2 -2
- package/dist/vanilla/adapters/index.mjs +1 -1
- package/dist/vanilla/index.d.mts +2 -2
- package/dist/vanilla/index.mjs +1 -1
- package/package.json +5 -5
- package/dist/better-auth-react-adapter-JoscqoDc.d.mts +0 -722
- package/dist/supabase-adapter-Clxlqg1x.d.mts +0 -127
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/@neondatabase/auth)
|
|
4
4
|
[](https://www.npmjs.com/package/@neondatabase/auth)
|
|
5
5
|
[](https://www.typescriptlang.org/)
|
|
6
|
-
[](https://github.com/neondatabase
|
|
6
|
+
[](https://github.com/neondatabase/neon-js/blob/main/LICENSE)
|
|
7
7
|
|
|
8
8
|
Authentication adapters for Neon Auth, supporting multiple auth providers.
|
|
9
9
|
|
|
@@ -19,6 +19,7 @@ This package is designed to work seamlessly with Neon's authentication infrastru
|
|
|
19
19
|
|
|
20
20
|
- **Simple default API** - Works out of the box with Better Auth patterns
|
|
21
21
|
- **Optional adapters** - Switch API styles for migrations or preferences
|
|
22
|
+
- **Anonymous access** - Optional RLS-based data access for unauthenticated users
|
|
22
23
|
- **Performance optimizations** - Session caching and request deduplication
|
|
23
24
|
- **TypeScript support** - Fully typed with strict type checking
|
|
24
25
|
|
|
@@ -144,6 +145,23 @@ function MyComponent() {
|
|
|
144
145
|
}
|
|
145
146
|
```
|
|
146
147
|
|
|
148
|
+
## Anonymous Access
|
|
149
|
+
|
|
150
|
+
Enable `allowAnonymous` to let unauthenticated users access data via RLS policies:
|
|
151
|
+
|
|
152
|
+
```typescript
|
|
153
|
+
import { createAuthClient } from '@neondatabase/auth';
|
|
154
|
+
|
|
155
|
+
const auth = createAuthClient('https://your-auth-server.com', {
|
|
156
|
+
allowAnonymous: true, // Enable anonymous data access
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
// Get token - returns anonymous token if no user session exists
|
|
160
|
+
const token = await auth.getJWTToken?.();
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
This is useful when you want to allow read-only public access to certain data while still enforcing RLS policies.
|
|
164
|
+
|
|
147
165
|
## API Reference
|
|
148
166
|
|
|
149
167
|
### createAuthClient(url, config?)
|
|
@@ -153,6 +171,7 @@ Factory function to create an auth client.
|
|
|
153
171
|
**Parameters:**
|
|
154
172
|
- `url` - The auth service URL (required)
|
|
155
173
|
- `config.adapter` - Optional adapter factory function (e.g., `SupabaseAuthAdapter()`)
|
|
174
|
+
- `config.allowAnonymous` - When `true`, returns an anonymous token if no user session exists (default: `false`)
|
|
156
175
|
|
|
157
176
|
**Returns:** The adapter's public API (varies by adapter type)
|
|
158
177
|
|