@drmhse/authos-node 0.1.1 → 0.1.2
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 +21 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -42,6 +42,27 @@ console.log(verified.claims);
|
|
|
42
42
|
// }
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
+
### TypeScript Integration
|
|
46
|
+
|
|
47
|
+
To get type support for `req.auth` in Express, you can extend the Request interface or use our utility type:
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
import { Request } from 'express';
|
|
51
|
+
import { TokenClaims } from '@drmhse/authos-node';
|
|
52
|
+
|
|
53
|
+
// Extend Express Request
|
|
54
|
+
declare global {
|
|
55
|
+
namespace Express {
|
|
56
|
+
interface Request {
|
|
57
|
+
auth?: {
|
|
58
|
+
claims: TokenClaims;
|
|
59
|
+
token: string;
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
45
66
|
### Express Middleware
|
|
46
67
|
|
|
47
68
|
Protect your Express routes with AuthOS authentication:
|
package/package.json
CHANGED