@logto/next 4.2.6 → 4.2.7
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.
|
@@ -36,8 +36,9 @@ export default class LogtoClient extends BaseClient {
|
|
|
36
36
|
* Handle sign-in callback from Logto.
|
|
37
37
|
*
|
|
38
38
|
* @param callbackUrl the uri (callbackUri) to redirect to after sign in, should match the one used in handleSignIn
|
|
39
|
+
* @returns the postRedirectUri if configured, otherwise undefined
|
|
39
40
|
*/
|
|
40
|
-
handleSignInCallback(callbackUrl: string): Promise<
|
|
41
|
+
handleSignInCallback(callbackUrl: string): Promise<string | undefined>;
|
|
41
42
|
/**
|
|
42
43
|
* Get Logto context from cookies.
|
|
43
44
|
*
|
|
@@ -42,10 +42,12 @@ class LogtoClient extends LogtoNextBaseClient {
|
|
|
42
42
|
* Handle sign-in callback from Logto.
|
|
43
43
|
*
|
|
44
44
|
* @param callbackUrl the uri (callbackUri) to redirect to after sign in, should match the one used in handleSignIn
|
|
45
|
+
* @returns the postRedirectUri if configured, otherwise undefined
|
|
45
46
|
*/
|
|
46
47
|
async handleSignInCallback(callbackUrl) {
|
|
47
48
|
const nodeClient = await this.createNodeClient();
|
|
48
49
|
await nodeClient.handleSignInCallback(callbackUrl);
|
|
50
|
+
return this.navigateUrl;
|
|
49
51
|
}
|
|
50
52
|
/**
|
|
51
53
|
* Get Logto context from cookies.
|
|
@@ -10,15 +10,19 @@ async function signIn(config, options, interactionMode) {
|
|
|
10
10
|
redirect(url);
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
* Handle sign in callback from search params or full redirect URL, save tokens to session
|
|
13
|
+
* Handle sign in callback from search params or full redirect URL, save tokens to session,
|
|
14
|
+
* and redirect to postRedirectUri if configured
|
|
14
15
|
* @param config The Logto configuration object
|
|
15
16
|
* @param searchParamsOrUrl Either URLSearchParams from the callback URL or the complete URL object
|
|
16
17
|
*/
|
|
17
18
|
async function handleSignIn(config, searchParamsOrUrl) {
|
|
18
19
|
const client = new LogtoClient(config);
|
|
19
|
-
await client.handleSignInCallback(searchParamsOrUrl instanceof URL
|
|
20
|
+
const postRedirectUri = await client.handleSignInCallback(searchParamsOrUrl instanceof URL
|
|
20
21
|
? searchParamsOrUrl.toString()
|
|
21
22
|
: `${config.baseUrl}/callback?${searchParamsOrUrl.toString()}`);
|
|
23
|
+
if (postRedirectUri) {
|
|
24
|
+
redirect(postRedirectUri);
|
|
25
|
+
}
|
|
22
26
|
}
|
|
23
27
|
/**
|
|
24
28
|
* Init sign out process, clear session, and redirect to the Logto sign-out page
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@logto/next",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"module": "./lib/src/index.js",
|
|
6
6
|
"types": "./lib/src/index.d.ts",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@edge-runtime/cookies": "^5.0.0",
|
|
45
45
|
"cookie": "^1.0.0",
|
|
46
|
-
"@logto/node": "^3.1.
|
|
46
|
+
"@logto/node": "^3.1.7"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@silverhand/eslint-config": "^6.0.1",
|
|
@@ -53,11 +53,11 @@
|
|
|
53
53
|
"@vitest/coverage-v8": "^2.1.9",
|
|
54
54
|
"eslint": "^8.57.0",
|
|
55
55
|
"lint-staged": "^15.0.0",
|
|
56
|
-
"next": "^15.
|
|
56
|
+
"next": "^15.5.9",
|
|
57
57
|
"next-test-api-route-handler": "^4.0.14",
|
|
58
58
|
"prettier": "^3.0.0",
|
|
59
|
-
"react": "19.
|
|
60
|
-
"react-dom": "19.
|
|
59
|
+
"react": "19.2.3",
|
|
60
|
+
"react-dom": "19.2.3",
|
|
61
61
|
"typescript": "^5.3.3",
|
|
62
62
|
"vitest": "^2.1.9"
|
|
63
63
|
},
|