@logto/next 2.1.1 → 2.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/lib/edge/index.cjs +5 -1
- package/lib/edge/index.js +5 -1
- package/lib/src/storage.d.ts +1 -1
- package/package.json +17 -7
package/lib/edge/index.cjs
CHANGED
|
@@ -52,7 +52,11 @@ class LogtoClient extends client.default {
|
|
|
52
52
|
const session = await edge.getIronSession(request, response, this.ironSessionConfigs);
|
|
53
53
|
const nodeClient = this.createNodeClient(session);
|
|
54
54
|
if (request.url) {
|
|
55
|
-
|
|
55
|
+
// When app is running behind reverse proxy which is common for edge runtime,
|
|
56
|
+
// the `request.url`'s domain may not be expected, replace to the configured baseUrl
|
|
57
|
+
const requestUrl = new URL(request.url);
|
|
58
|
+
const callbackUrl = new URL(`${requestUrl.pathname}${requestUrl.search}${requestUrl.hash}`, this.config.baseUrl);
|
|
59
|
+
await nodeClient.handleSignInCallback(callbackUrl.toString());
|
|
56
60
|
await this.storage?.save();
|
|
57
61
|
}
|
|
58
62
|
return response;
|
package/lib/edge/index.js
CHANGED
|
@@ -44,7 +44,11 @@ class LogtoClient extends LogtoNextBaseClient {
|
|
|
44
44
|
const session = await getIronSession(request, response, this.ironSessionConfigs);
|
|
45
45
|
const nodeClient = this.createNodeClient(session);
|
|
46
46
|
if (request.url) {
|
|
47
|
-
|
|
47
|
+
// When app is running behind reverse proxy which is common for edge runtime,
|
|
48
|
+
// the `request.url`'s domain may not be expected, replace to the configured baseUrl
|
|
49
|
+
const requestUrl = new URL(request.url);
|
|
50
|
+
const callbackUrl = new URL(`${requestUrl.pathname}${requestUrl.search}${requestUrl.hash}`, this.config.baseUrl);
|
|
51
|
+
await nodeClient.handleSignInCallback(callbackUrl.toString());
|
|
48
52
|
await this.storage?.save();
|
|
49
53
|
}
|
|
50
54
|
return response;
|
package/lib/src/storage.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Storage, StorageKey } from '@logto/node';
|
|
2
2
|
import { type IronSession } from 'iron-session';
|
|
3
|
-
export default class NextStorage implements Storage {
|
|
3
|
+
export default class NextStorage implements Storage<StorageKey> {
|
|
4
4
|
private readonly session;
|
|
5
5
|
private sessionChanged;
|
|
6
6
|
constructor(session: IronSession);
|
package/package.json
CHANGED
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@logto/next",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./lib/src/index.cjs",
|
|
6
6
|
"module": "./lib/src/index.js",
|
|
7
7
|
"types": "./lib/src/index.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
"*": {
|
|
10
|
+
"*": [
|
|
11
|
+
"./lib/src/index.d.ts"
|
|
12
|
+
],
|
|
13
|
+
"edge": [
|
|
14
|
+
"./lib/edge/index.d.ts"
|
|
15
|
+
]
|
|
16
|
+
}
|
|
17
|
+
},
|
|
8
18
|
"exports": {
|
|
9
19
|
".": {
|
|
10
20
|
"require": "./lib/src/index.cjs",
|
|
@@ -31,20 +41,20 @@
|
|
|
31
41
|
"iron-session": "^6.3.1"
|
|
32
42
|
},
|
|
33
43
|
"devDependencies": {
|
|
34
|
-
"@silverhand/eslint-config": "^
|
|
35
|
-
"@silverhand/ts-config": "^
|
|
36
|
-
"@silverhand/ts-config-react": "^
|
|
44
|
+
"@silverhand/eslint-config": "^4.0.1",
|
|
45
|
+
"@silverhand/ts-config": "^4.0.0",
|
|
46
|
+
"@silverhand/ts-config-react": "^4.0.0",
|
|
37
47
|
"@swc/core": "^1.3.50",
|
|
38
48
|
"@swc/jest": "^0.2.24",
|
|
39
49
|
"@types/jest": "^29.5.0",
|
|
40
|
-
"eslint": "^8.
|
|
50
|
+
"eslint": "^8.44.0",
|
|
41
51
|
"jest": "^29.5.0",
|
|
42
52
|
"jest-location-mock": "^1.0.9",
|
|
43
53
|
"jest-matcher-specific-error": "^1.0.0",
|
|
44
|
-
"lint-staged": "^
|
|
54
|
+
"lint-staged": "^14.0.0",
|
|
45
55
|
"next": "^13.0.4",
|
|
46
56
|
"next-test-api-route-handler": "^3.1.6",
|
|
47
|
-
"prettier": "^
|
|
57
|
+
"prettier": "^3.0.0",
|
|
48
58
|
"react": "^18.2.0",
|
|
49
59
|
"react-dom": "^18.2.0",
|
|
50
60
|
"typescript": "^5.0.0"
|