@logto/express 3.0.5 → 3.0.8
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/lib/index.js +15 -10
- package/package.json +2 -2
package/lib/index.js
CHANGED
|
@@ -60,16 +60,21 @@ const handleAuthRoutes = (config) => {
|
|
|
60
60
|
return router;
|
|
61
61
|
};
|
|
62
62
|
const withLogto = (config) => async (request, response, next) => {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
63
|
+
try {
|
|
64
|
+
const client = createNodeClient(request, response, config);
|
|
65
|
+
const user = await client.getContext({
|
|
66
|
+
getAccessToken: config.getAccessToken,
|
|
67
|
+
resource: config.resource,
|
|
68
|
+
fetchUserInfo: config.fetchUserInfo,
|
|
69
|
+
getOrganizationToken: config.getOrganizationToken,
|
|
70
|
+
});
|
|
71
|
+
// eslint-disable-next-line @silverhand/fp/no-mutating-methods
|
|
72
|
+
Object.defineProperty(request, 'user', { enumerable: true, get: () => user });
|
|
73
|
+
next();
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
next(error);
|
|
77
|
+
}
|
|
73
78
|
};
|
|
74
79
|
|
|
75
80
|
export { handleAuthRoutes, withLogto };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@logto/express",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"module": "./lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"directory": "packages/express"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@logto/node": "^3.1.
|
|
22
|
+
"@logto/node": "^3.1.3"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@silverhand/eslint-config": "^6.0.1",
|