You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The plugin uses [better-auth](https://www.better-auth.com/) for robust, production-ready authentication functionality.
34
+
The plugin uses [better-auth](https://www.better-auth.com/) for robust, production-ready authentication functionality. All requests are forwarded directly to better-auth's universal handler, ensuring full compatibility with all better-auth features.
32
35
33
36
## Installation
34
37
@@ -90,29 +93,76 @@ The plugin accepts configuration via `AuthConfig` schema from `@objectstack/spec
90
93
91
94
## API Routes
92
95
93
-
The plugin registers the following authentication endpoints:
96
+
The plugin forwards all requests under `/api/v1/auth/*` directly to better-auth's universal handler. Better-auth provides the following endpoints:
97
+
98
+
### Email/Password Authentication
99
+
-`POST /api/v1/auth/sign-in/email` - Sign in with email and password
100
+
-`POST /api/v1/auth/sign-up/email` - Register new user with email and password
101
+
-`POST /api/v1/auth/sign-out` - Sign out current user
102
+
103
+
### Session Management
104
+
-`GET /api/v1/auth/get-session` - Get current user session
-`POST /api/v1/auth/login` - User login with email/password
96
-
-`POST /api/v1/auth/register` - User registration
97
-
-`POST /api/v1/auth/logout` - User logout
98
-
-`GET /api/v1/auth/session` - Get current session
122
+
### Passkeys (when enabled)
123
+
-`POST /api/v1/auth/passkey/register` - Register a passkey
124
+
-`POST /api/v1/auth/passkey/authenticate` - Authenticate with passkey
99
125
100
-
**Note:** Routes are currently wired up and returning placeholder responses while better-auth API integration is completed. OAuth provider routes will be added in upcoming releases.
126
+
### Magic Links (when enabled)
127
+
-`POST /api/v1/auth/magic-link/send` - Send magic link email
128
+
-`GET /api/v1/auth/magic-link/verify` - Verify magic link
129
+
130
+
For the complete API reference, see [better-auth documentation](https://www.better-auth.com/docs).
101
131
102
132
## Implementation Status
103
133
104
134
This package provides authentication services powered by better-auth. Current implementation status:
105
135
106
136
1. ✅ Plugin lifecycle (init, start, destroy)
107
-
2. ✅ HTTP route registration
137
+
2. ✅ HTTP route registration (wildcard routing)
108
138
3. ✅ Configuration validation
109
139
4. ✅ Service registration
110
140
5. ✅ Better-auth library integration (v1.4.18)
111
-
6. ✅ AuthManager class with lazy initialization
112
-
7. 🔄 Better-auth API method integration (in progress)
113
-
8. ⏳ Database adapter integration (planned)
114
-
9. ⏳ OAuth providers (planned)
115
-
10. ⏳ Advanced features (2FA, passkeys, magic links)
141
+
6. ✅ Direct request forwarding to better-auth handler
142
+
7. ✅ Full better-auth API support
143
+
8. ✅ OAuth providers (configurable)
144
+
9. ✅ 2FA, passkeys, magic links (configurable)
145
+
10. 🔄 Database adapter integration (in progress)
146
+
147
+
### Architecture
148
+
149
+
The plugin uses a **direct forwarding** approach:
150
+
151
+
```typescript
152
+
// All requests under /api/v1/auth/* are forwarded to better-auth
0 commit comments