@drmhse/authos-node 0.1.2 → 0.1.3
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 +17 -14
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -44,22 +44,25 @@ console.log(verified.claims);
|
|
|
44
44
|
|
|
45
45
|
### TypeScript Integration
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
The `req.auth` type is automatically augmented when you import from `@drmhse/authos-node/express`. No manual setup required!
|
|
48
48
|
|
|
49
49
|
```ts
|
|
50
|
-
import {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
50
|
+
import { createAuthMiddleware } from '@drmhse/authos-node/express';
|
|
51
|
+
|
|
52
|
+
// TypeScript knows about req.auth automatically
|
|
53
|
+
app.get('/profile', requireAuth(), (req, res) => {
|
|
54
|
+
const userId = req.auth?.claims.sub; // ✓ Typed correctly
|
|
55
|
+
res.json({ userId });
|
|
56
|
+
});
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
If you need access to the token claims type directly:
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
import { TokenClaims, VerifiedToken } from '@drmhse/authos-node';
|
|
63
|
+
|
|
64
|
+
function processUser(auth: VerifiedToken) {
|
|
65
|
+
console.log(auth.claims.email);
|
|
63
66
|
}
|
|
64
67
|
```
|
|
65
68
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@drmhse/authos-node",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Node.js server adapter for AuthOS authentication - Express middleware and token verification",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
}
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@drmhse/sso-sdk": "^0.3.
|
|
61
|
+
"@drmhse/sso-sdk": "^0.3.8"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@types/express": "^5.0.0",
|