@logto/client 3.0.0-alpha.0 → 3.0.0-alpha.2
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/adapter/types.d.ts +9 -3
- package/lib/client.cjs +2 -2
- package/lib/client.js +2 -2
- package/lib/types/index.d.ts +1 -1
- package/package.json +2 -2
package/lib/adapter/types.d.ts
CHANGED
|
@@ -37,13 +37,19 @@ export type InferStorageKey<S> = S extends Storage<infer Key> ? Key : never;
|
|
|
37
37
|
* The navigation function that redirects the user to the specified URL.
|
|
38
38
|
*
|
|
39
39
|
* @param url The URL to navigate to.
|
|
40
|
-
* @param
|
|
41
|
-
*
|
|
40
|
+
* @param parameters The parameters for the navigation.
|
|
41
|
+
* @param parameters.redirectUri The redirect URI that the user will be redirected to after the
|
|
42
|
+
* flow is completed. That is, the "redirect URI" for sign-in and "post-logout redirect URI" for
|
|
43
|
+
* sign-out.
|
|
44
|
+
* @param parameters.for The purpose of the navigation. It can be either "sign-in" or "sign-out".
|
|
42
45
|
* @remarks Usually, the `redirectUri` parameter can be ignored unless the client needs to pass the
|
|
43
46
|
* redirect scheme or other parameters to the native app, such as `ASWebAuthenticationSession` in
|
|
44
47
|
* iOS.
|
|
45
48
|
*/
|
|
46
|
-
export type Navigate = (url: string,
|
|
49
|
+
export type Navigate = (url: string, parameters: {
|
|
50
|
+
redirectUri?: string;
|
|
51
|
+
for: 'sign-in' | 'sign-out';
|
|
52
|
+
}) => void | Promise<void>;
|
|
47
53
|
export type JwtVerifier = {
|
|
48
54
|
verifyIdToken(idToken: string): Promise<void>;
|
|
49
55
|
};
|
package/lib/client.cjs
CHANGED
|
@@ -179,7 +179,7 @@ class StandardLogtoClient {
|
|
|
179
179
|
this.setRefreshToken(null),
|
|
180
180
|
this.setIdToken(null),
|
|
181
181
|
]);
|
|
182
|
-
await this.adapter.navigate(signInUri, redirectUri);
|
|
182
|
+
await this.adapter.navigate(signInUri, { redirectUri, for: 'sign-in' });
|
|
183
183
|
}
|
|
184
184
|
/**
|
|
185
185
|
* Check if the user is redirected from the sign-in page by checking if the
|
|
@@ -231,7 +231,7 @@ class StandardLogtoClient {
|
|
|
231
231
|
this.setIdToken(null),
|
|
232
232
|
this.adapter.storage.removeItem('accessToken'),
|
|
233
233
|
]);
|
|
234
|
-
await this.adapter.navigate(url, postLogoutRedirectUri);
|
|
234
|
+
await this.adapter.navigate(url, { redirectUri: postLogoutRedirectUri, for: 'sign-out' });
|
|
235
235
|
}
|
|
236
236
|
async getSignInSession() {
|
|
237
237
|
const jsonItem = await this.adapter.storage.getItem('signInSession');
|
package/lib/client.js
CHANGED
|
@@ -177,7 +177,7 @@ class StandardLogtoClient {
|
|
|
177
177
|
this.setRefreshToken(null),
|
|
178
178
|
this.setIdToken(null),
|
|
179
179
|
]);
|
|
180
|
-
await this.adapter.navigate(signInUri, redirectUri);
|
|
180
|
+
await this.adapter.navigate(signInUri, { redirectUri, for: 'sign-in' });
|
|
181
181
|
}
|
|
182
182
|
/**
|
|
183
183
|
* Check if the user is redirected from the sign-in page by checking if the
|
|
@@ -229,7 +229,7 @@ class StandardLogtoClient {
|
|
|
229
229
|
this.setIdToken(null),
|
|
230
230
|
this.adapter.storage.removeItem('accessToken'),
|
|
231
231
|
]);
|
|
232
|
-
await this.adapter.navigate(url, postLogoutRedirectUri);
|
|
232
|
+
await this.adapter.navigate(url, { redirectUri: postLogoutRedirectUri, for: 'sign-out' });
|
|
233
233
|
}
|
|
234
234
|
async getSignInSession() {
|
|
235
235
|
const jsonItem = await this.adapter.storage.getItem('signInSession');
|
package/lib/types/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@logto/client",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./lib/index.cjs",
|
|
6
6
|
"module": "./lib/index.js",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"directory": "packages/client"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@logto/js": "^4.0.0-alpha.
|
|
32
|
+
"@logto/js": "^4.0.0-alpha.2",
|
|
33
33
|
"@silverhand/essentials": "^2.8.7",
|
|
34
34
|
"camelcase-keys": "^7.0.1",
|
|
35
35
|
"jose": "^5.0.0"
|