@autonoma-ai/server-node 0.1.3 → 0.1.4
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 +8 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@ const handler = createNodeHandler({
|
|
|
22
22
|
signingSecret: process.env.AUTONOMA_SIGNING_SECRET!,
|
|
23
23
|
auth: async (user) => {
|
|
24
24
|
const session = await createSession(user.id as string)
|
|
25
|
-
return {
|
|
25
|
+
return { headers: { Authorization: `Bearer ${session.token}` } }
|
|
26
26
|
},
|
|
27
27
|
})
|
|
28
28
|
|
|
@@ -36,7 +36,7 @@ http.createServer((req, res) => {
|
|
|
36
36
|
|
|
37
37
|
## Auth callback
|
|
38
38
|
|
|
39
|
-
The `auth` callback receives the first `User` created during setup and must return
|
|
39
|
+
The `auth` callback receives the first `User` record created during setup (or `null` if no User model exists) and must return credentials for the test runner to authenticate:
|
|
40
40
|
|
|
41
41
|
```typescript
|
|
42
42
|
// Session cookie
|
|
@@ -50,7 +50,12 @@ auth: async (user) => {
|
|
|
50
50
|
// Bearer token
|
|
51
51
|
auth: async (user) => {
|
|
52
52
|
const token = jwt.sign({ sub: user.id }, SECRET)
|
|
53
|
-
return { token }
|
|
53
|
+
return { headers: { Authorization: `Bearer ${token}` } }
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Username + password (for login-page flows)
|
|
57
|
+
auth: async (user) => {
|
|
58
|
+
return { credentials: { email: user.email as string, password: 'TestP@ssw0rd123!' } }
|
|
54
59
|
}
|
|
55
60
|
```
|
|
56
61
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autonoma-ai/server-node",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Node.js http server adapter for Autonoma SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"access": "public"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@autonoma-ai/sdk": "0.1.
|
|
19
|
+
"@autonoma-ai/sdk": "0.1.4"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/node": "^22.0.0",
|