@logto/next 3.2.6 → 3.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.
|
@@ -18,16 +18,17 @@ const signIn = async (config, redirectUri, interactionMode) => {
|
|
|
18
18
|
navigation.redirect(url);
|
|
19
19
|
};
|
|
20
20
|
/**
|
|
21
|
-
* Handle sign in callback from search params, save tokens to session
|
|
21
|
+
* Handle sign in callback from search params or full redirect URL, save tokens to session
|
|
22
22
|
*/
|
|
23
|
-
|
|
24
|
-
const search = searchParams.toString();
|
|
23
|
+
async function handleSignIn(config, searchParamsOrUrl) {
|
|
25
24
|
const client$1 = new client.default(config);
|
|
26
|
-
const newCookie = await client$1.handleSignInCallback(await cookie.getCookies(config),
|
|
25
|
+
const newCookie = await client$1.handleSignInCallback(await cookie.getCookies(config), searchParamsOrUrl instanceof URL
|
|
26
|
+
? searchParamsOrUrl.toString()
|
|
27
|
+
: `${config.baseUrl}/callback?${searchParamsOrUrl.toString()}`);
|
|
27
28
|
if (newCookie) {
|
|
28
29
|
await cookie.setCookies(newCookie, config);
|
|
29
30
|
}
|
|
30
|
-
}
|
|
31
|
+
}
|
|
31
32
|
/**
|
|
32
33
|
* Init sign out process, clear session, and redirect to the Logto sign-out page
|
|
33
34
|
*/
|
|
@@ -5,10 +5,8 @@ export type { LogtoContext, InteractionMode } from '@logto/node';
|
|
|
5
5
|
* Init sign in process and redirect to the Logto sign-in page
|
|
6
6
|
*/
|
|
7
7
|
export declare const signIn: (config: LogtoNextConfig, redirectUri?: string, interactionMode?: InteractionMode) => Promise<void>;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
*/
|
|
11
|
-
export declare const handleSignIn: (config: LogtoNextConfig, searchParams: URLSearchParams) => Promise<void>;
|
|
8
|
+
export declare function handleSignIn(config: LogtoNextConfig, searchParams: URLSearchParams): Promise<void>;
|
|
9
|
+
export declare function handleSignIn(config: LogtoNextConfig, url: URL): Promise<void>;
|
|
12
10
|
/**
|
|
13
11
|
* Init sign out process, clear session, and redirect to the Logto sign-out page
|
|
14
12
|
*/
|
|
@@ -14,16 +14,17 @@ const signIn = async (config, redirectUri, interactionMode) => {
|
|
|
14
14
|
redirect(url);
|
|
15
15
|
};
|
|
16
16
|
/**
|
|
17
|
-
* Handle sign in callback from search params, save tokens to session
|
|
17
|
+
* Handle sign in callback from search params or full redirect URL, save tokens to session
|
|
18
18
|
*/
|
|
19
|
-
|
|
20
|
-
const search = searchParams.toString();
|
|
19
|
+
async function handleSignIn(config, searchParamsOrUrl) {
|
|
21
20
|
const client = new LogtoClient(config);
|
|
22
|
-
const newCookie = await client.handleSignInCallback(await getCookies(config),
|
|
21
|
+
const newCookie = await client.handleSignInCallback(await getCookies(config), searchParamsOrUrl instanceof URL
|
|
22
|
+
? searchParamsOrUrl.toString()
|
|
23
|
+
: `${config.baseUrl}/callback?${searchParamsOrUrl.toString()}`);
|
|
23
24
|
if (newCookie) {
|
|
24
25
|
await setCookies(newCookie, config);
|
|
25
26
|
}
|
|
26
|
-
}
|
|
27
|
+
}
|
|
27
28
|
/**
|
|
28
29
|
* Init sign out process, clear session, and redirect to the Logto sign-out page
|
|
29
30
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@logto/next",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./lib/src/index.cjs",
|
|
6
6
|
"module": "./lib/src/index.js",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@edge-runtime/cookies": "^4.0.0",
|
|
49
|
-
"@logto/node": "^2.5.
|
|
49
|
+
"@logto/node": "^2.5.1"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@silverhand/eslint-config": "^6.0.1",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"@vitest/coverage-v8": "^1.4.0",
|
|
56
56
|
"eslint": "^8.57.0",
|
|
57
57
|
"lint-staged": "^15.0.0",
|
|
58
|
-
"next": "^14.
|
|
58
|
+
"next": "^14.1.1",
|
|
59
59
|
"next-test-api-route-handler": "^4.0.0",
|
|
60
60
|
"prettier": "^3.0.0",
|
|
61
61
|
"react": "^18.2.0",
|