@logto/client 2.2.2 → 2.2.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/README.md +0 -2
- package/lib/index.cjs +6 -3
- package/lib/index.d.ts +4 -3
- package/lib/index.js +6 -3
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -5,8 +5,6 @@
|
|
|
5
5
|
|
|
6
6
|
The Logto JavaScript Client SDK written in TypeScript. Check out our [docs](https://docs.logto.io/sdk/JavaScript/client/) for more information.
|
|
7
7
|
|
|
8
|
-
We also provide [文档](https://docs.logto.io/zh-cn/sdk/JavaScript/sdk/client/) in Simplified Chinese.
|
|
9
|
-
|
|
10
8
|
## Installation
|
|
11
9
|
|
|
12
10
|
### Using npm
|
package/lib/index.cjs
CHANGED
|
@@ -183,8 +183,9 @@ class LogtoClient {
|
|
|
183
183
|
* Handle the sign-in callback by parsing the authorization code from the
|
|
184
184
|
* callback URI and exchanging it for the tokens.
|
|
185
185
|
*
|
|
186
|
-
* @param callbackUri The callback URI that the user is redirected to after the sign-in flow is completed.
|
|
187
|
-
*
|
|
186
|
+
* @param callbackUri The callback URI, including the search params, that the user is redirected to after the sign-in flow is completed.
|
|
187
|
+
* The origin and pathname of this URI must match the origin and pathname of the redirect URI specified in {@link signIn}.
|
|
188
|
+
* In many cases you'll probably end up passing `window.location.href` as the argument to this function.
|
|
188
189
|
* @throws LogtoClientError if the sign-in session is not found.
|
|
189
190
|
*/
|
|
190
191
|
async handleSignInCallback(callbackUri) {
|
|
@@ -302,7 +303,9 @@ class LogtoClient {
|
|
|
302
303
|
expiresAt: requestedAt + expiresIn,
|
|
303
304
|
});
|
|
304
305
|
await this.saveAccessTokenMap();
|
|
305
|
-
|
|
306
|
+
if (refreshToken) {
|
|
307
|
+
await this.setRefreshToken(refreshToken);
|
|
308
|
+
}
|
|
306
309
|
if (idToken) {
|
|
307
310
|
await this.verifyIdToken(idToken);
|
|
308
311
|
await this.setIdToken(idToken);
|
package/lib/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { type JWTVerifyGetKey } from 'jose';
|
|
|
4
4
|
import { ClientAdapterInstance, type ClientAdapter } from './adapter/index.js';
|
|
5
5
|
import type { AccessToken, LogtoConfig, LogtoSignInSessionItem } from './types/index.js';
|
|
6
6
|
export type { IdTokenClaims, LogtoErrorCode, UserInfoResponse, InteractionMode } from '@logto/js';
|
|
7
|
-
export { LogtoError, OidcError, Prompt,
|
|
7
|
+
export { LogtoError, LogtoRequestError, OidcError, Prompt, ReservedScope, UserScope, } from '@logto/js';
|
|
8
8
|
export * from './errors.js';
|
|
9
9
|
export type { Storage, StorageKey, ClientAdapter } from './adapter/index.js';
|
|
10
10
|
export { PersistKey, CacheKey } from './adapter/index.js';
|
|
@@ -112,8 +112,9 @@ export default class LogtoClient {
|
|
|
112
112
|
* Handle the sign-in callback by parsing the authorization code from the
|
|
113
113
|
* callback URI and exchanging it for the tokens.
|
|
114
114
|
*
|
|
115
|
-
* @param callbackUri The callback URI that the user is redirected to after the sign-in flow is completed.
|
|
116
|
-
*
|
|
115
|
+
* @param callbackUri The callback URI, including the search params, that the user is redirected to after the sign-in flow is completed.
|
|
116
|
+
* The origin and pathname of this URI must match the origin and pathname of the redirect URI specified in {@link signIn}.
|
|
117
|
+
* In many cases you'll probably end up passing `window.location.href` as the argument to this function.
|
|
117
118
|
* @throws LogtoClientError if the sign-in session is not found.
|
|
118
119
|
*/
|
|
119
120
|
handleSignInCallback(callbackUri: string): Promise<void>;
|
package/lib/index.js
CHANGED
|
@@ -180,8 +180,9 @@ class LogtoClient {
|
|
|
180
180
|
* Handle the sign-in callback by parsing the authorization code from the
|
|
181
181
|
* callback URI and exchanging it for the tokens.
|
|
182
182
|
*
|
|
183
|
-
* @param callbackUri The callback URI that the user is redirected to after the sign-in flow is completed.
|
|
184
|
-
*
|
|
183
|
+
* @param callbackUri The callback URI, including the search params, that the user is redirected to after the sign-in flow is completed.
|
|
184
|
+
* The origin and pathname of this URI must match the origin and pathname of the redirect URI specified in {@link signIn}.
|
|
185
|
+
* In many cases you'll probably end up passing `window.location.href` as the argument to this function.
|
|
185
186
|
* @throws LogtoClientError if the sign-in session is not found.
|
|
186
187
|
*/
|
|
187
188
|
async handleSignInCallback(callbackUri) {
|
|
@@ -299,7 +300,9 @@ class LogtoClient {
|
|
|
299
300
|
expiresAt: requestedAt + expiresIn,
|
|
300
301
|
});
|
|
301
302
|
await this.saveAccessTokenMap();
|
|
302
|
-
|
|
303
|
+
if (refreshToken) {
|
|
304
|
+
await this.setRefreshToken(refreshToken);
|
|
305
|
+
}
|
|
303
306
|
if (idToken) {
|
|
304
307
|
await this.verifyIdToken(idToken);
|
|
305
308
|
await this.setIdToken(idToken);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@logto/client",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./lib/index.cjs",
|
|
6
6
|
"module": "./lib/index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"directory": "packages/client"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@logto/js": "^2.1.
|
|
24
|
+
"@logto/js": "^2.1.3",
|
|
25
25
|
"@silverhand/essentials": "^2.6.2",
|
|
26
26
|
"camelcase-keys": "^7.0.1",
|
|
27
27
|
"jose": "^4.13.2"
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
"eslint": "^8.44.0",
|
|
37
37
|
"jest": "^29.5.0",
|
|
38
38
|
"jest-matcher-specific-error": "^1.0.0",
|
|
39
|
-
"lint-staged": "^
|
|
39
|
+
"lint-staged": "^14.0.0",
|
|
40
40
|
"nock": "^13.3.0",
|
|
41
41
|
"prettier": "^3.0.0",
|
|
42
42
|
"text-encoder": "^0.0.4",
|
|
43
|
-
"type-fest": "^
|
|
43
|
+
"type-fest": "^4.0.0",
|
|
44
44
|
"typescript": "^5.0.0"
|
|
45
45
|
},
|
|
46
46
|
"eslintConfig": {
|