@logto/express 2.0.2 → 2.1.0
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.cjs +4 -3
- package/lib/index.js +4 -3
- package/lib/types.d.ts +1 -0
- package/package.json +7 -7
package/lib/index.cjs
CHANGED
|
@@ -26,16 +26,17 @@ const createNodeClient = (request, response, config) => {
|
|
|
26
26
|
const handleAuthRoutes = (config) => {
|
|
27
27
|
// eslint-disable-next-line new-cap
|
|
28
28
|
const router = express.Router();
|
|
29
|
-
|
|
29
|
+
const prefix = config.authRoutesPrefix ?? 'logto';
|
|
30
|
+
router.use(`/${prefix}/:action`, async (request, response) => {
|
|
30
31
|
const { action } = request.params;
|
|
31
32
|
const nodeClient = createNodeClient(request, response, config);
|
|
32
33
|
switch (action) {
|
|
33
34
|
case 'sign-in': {
|
|
34
|
-
await nodeClient.signIn(`${config.baseUrl}/
|
|
35
|
+
await nodeClient.signIn(`${config.baseUrl}/${prefix}/sign-in-callback`);
|
|
35
36
|
break;
|
|
36
37
|
}
|
|
37
38
|
case 'sign-up': {
|
|
38
|
-
await nodeClient.signIn(`${config.baseUrl}/
|
|
39
|
+
await nodeClient.signIn(`${config.baseUrl}/${prefix}/sign-in-callback`, 'signUp');
|
|
39
40
|
break;
|
|
40
41
|
}
|
|
41
42
|
case 'sign-in-callback': {
|
package/lib/index.js
CHANGED
|
@@ -21,16 +21,17 @@ const createNodeClient = (request, response, config) => {
|
|
|
21
21
|
const handleAuthRoutes = (config) => {
|
|
22
22
|
// eslint-disable-next-line new-cap
|
|
23
23
|
const router = Router();
|
|
24
|
-
|
|
24
|
+
const prefix = config.authRoutesPrefix ?? 'logto';
|
|
25
|
+
router.use(`/${prefix}/:action`, async (request, response) => {
|
|
25
26
|
const { action } = request.params;
|
|
26
27
|
const nodeClient = createNodeClient(request, response, config);
|
|
27
28
|
switch (action) {
|
|
28
29
|
case 'sign-in': {
|
|
29
|
-
await nodeClient.signIn(`${config.baseUrl}/
|
|
30
|
+
await nodeClient.signIn(`${config.baseUrl}/${prefix}/sign-in-callback`);
|
|
30
31
|
break;
|
|
31
32
|
}
|
|
32
33
|
case 'sign-up': {
|
|
33
|
-
await nodeClient.signIn(`${config.baseUrl}/
|
|
34
|
+
await nodeClient.signIn(`${config.baseUrl}/${prefix}/sign-in-callback`, 'signUp');
|
|
34
35
|
break;
|
|
35
36
|
}
|
|
36
37
|
case 'sign-in-callback': {
|
package/lib/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@logto/express",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./lib/index.cjs",
|
|
6
6
|
"module": "./lib/index.js",
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
"@logto/node": "^2.1.1"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@silverhand/eslint-config": "^
|
|
28
|
-
"@silverhand/ts-config": "^
|
|
29
|
-
"@silverhand/ts-config-react": "^
|
|
27
|
+
"@silverhand/eslint-config": "^4.0.1",
|
|
28
|
+
"@silverhand/ts-config": "^4.0.0",
|
|
29
|
+
"@silverhand/ts-config-react": "^4.0.0",
|
|
30
30
|
"@swc/core": "^1.3.50",
|
|
31
31
|
"@swc/jest": "^0.2.24",
|
|
32
32
|
"@types/cookie-parser": "^1.4.3",
|
|
@@ -35,14 +35,14 @@
|
|
|
35
35
|
"@types/jest": "^29.5.0",
|
|
36
36
|
"@types/supertest": "^2.0.12",
|
|
37
37
|
"cookie-parser": "^1.4.6",
|
|
38
|
-
"eslint": "^8.
|
|
38
|
+
"eslint": "^8.44.0",
|
|
39
39
|
"express": "^4.18.1",
|
|
40
40
|
"express-session": "^1.17.3",
|
|
41
41
|
"jest": "^29.5.0",
|
|
42
42
|
"jest-location-mock": "^1.0.9",
|
|
43
43
|
"jest-matcher-specific-error": "^1.0.0",
|
|
44
|
-
"lint-staged": "^
|
|
45
|
-
"prettier": "^
|
|
44
|
+
"lint-staged": "^14.0.0",
|
|
45
|
+
"prettier": "^3.0.0",
|
|
46
46
|
"supertest": "^6.3.3",
|
|
47
47
|
"typescript": "^5.0.0"
|
|
48
48
|
},
|