@logto/client 2.6.4 → 2.6.5
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/client.cjs +8 -4
- package/lib/client.d.ts +4 -1
- package/lib/client.js +8 -4
- package/package.json +1 -1
package/lib/client.cjs
CHANGED
|
@@ -57,6 +57,10 @@ class StandardLogtoClient {
|
|
|
57
57
|
* It uses the same refresh strategy as {@link getAccessToken}.
|
|
58
58
|
*/
|
|
59
59
|
this.getOrganizationToken = memoize.memoize(this.#getOrganizationToken);
|
|
60
|
+
/**
|
|
61
|
+
* Clear the access token from the cache storage.
|
|
62
|
+
*/
|
|
63
|
+
this.clearAccessToken = memoize.memoize(this.#clearAccessToken);
|
|
60
64
|
/**
|
|
61
65
|
* Handle the sign-in callback by parsing the authorization code from the
|
|
62
66
|
* callback URI and exchanging it for the tokens.
|
|
@@ -252,10 +256,6 @@ class StandardLogtoClient {
|
|
|
252
256
|
async setRefreshToken(value) {
|
|
253
257
|
return this.adapter.setStorageItem(types.PersistKey.RefreshToken, value);
|
|
254
258
|
}
|
|
255
|
-
async clearAccessToken() {
|
|
256
|
-
this.accessTokenMap.clear();
|
|
257
|
-
await this.adapter.storage.removeItem('accessToken');
|
|
258
|
-
}
|
|
259
259
|
async getAccessTokenByRefreshToken(resource, organizationId) {
|
|
260
260
|
const currentRefreshToken = await this.getRefreshToken();
|
|
261
261
|
if (!currentRefreshToken) {
|
|
@@ -347,6 +347,10 @@ class StandardLogtoClient {
|
|
|
347
347
|
}
|
|
348
348
|
return this.getAccessToken(undefined, organizationId);
|
|
349
349
|
}
|
|
350
|
+
async #clearAccessToken() {
|
|
351
|
+
this.accessTokenMap.clear();
|
|
352
|
+
await this.adapter.storage.removeItem('accessToken');
|
|
353
|
+
}
|
|
350
354
|
async #handleSignInCallback(callbackUri) {
|
|
351
355
|
const signInSession = await this.getSignInSession();
|
|
352
356
|
if (!signInSession) {
|
package/lib/client.d.ts
CHANGED
|
@@ -66,6 +66,10 @@ export declare class StandardLogtoClient {
|
|
|
66
66
|
* It uses the same refresh strategy as {@link getAccessToken}.
|
|
67
67
|
*/
|
|
68
68
|
readonly getOrganizationToken: (this: unknown, organizationId: string) => Promise<string>;
|
|
69
|
+
/**
|
|
70
|
+
* Clear the access token from the cache storage.
|
|
71
|
+
*/
|
|
72
|
+
readonly clearAccessToken: (this: unknown) => Promise<void>;
|
|
69
73
|
/**
|
|
70
74
|
* Handle the sign-in callback by parsing the authorization code from the
|
|
71
75
|
* callback URI and exchanging it for the tokens.
|
|
@@ -188,7 +192,6 @@ export declare class StandardLogtoClient {
|
|
|
188
192
|
protected setSignInSession(value: Nullable<LogtoSignInSessionItem>): Promise<void>;
|
|
189
193
|
private setIdToken;
|
|
190
194
|
private setRefreshToken;
|
|
191
|
-
private clearAccessToken;
|
|
192
195
|
private getAccessTokenByRefreshToken;
|
|
193
196
|
private saveAccessTokenMap;
|
|
194
197
|
private loadAccessTokenMap;
|
package/lib/client.js
CHANGED
|
@@ -55,6 +55,10 @@ class StandardLogtoClient {
|
|
|
55
55
|
* It uses the same refresh strategy as {@link getAccessToken}.
|
|
56
56
|
*/
|
|
57
57
|
this.getOrganizationToken = memoize(this.#getOrganizationToken);
|
|
58
|
+
/**
|
|
59
|
+
* Clear the access token from the cache storage.
|
|
60
|
+
*/
|
|
61
|
+
this.clearAccessToken = memoize(this.#clearAccessToken);
|
|
58
62
|
/**
|
|
59
63
|
* Handle the sign-in callback by parsing the authorization code from the
|
|
60
64
|
* callback URI and exchanging it for the tokens.
|
|
@@ -250,10 +254,6 @@ class StandardLogtoClient {
|
|
|
250
254
|
async setRefreshToken(value) {
|
|
251
255
|
return this.adapter.setStorageItem(PersistKey.RefreshToken, value);
|
|
252
256
|
}
|
|
253
|
-
async clearAccessToken() {
|
|
254
|
-
this.accessTokenMap.clear();
|
|
255
|
-
await this.adapter.storage.removeItem('accessToken');
|
|
256
|
-
}
|
|
257
257
|
async getAccessTokenByRefreshToken(resource, organizationId) {
|
|
258
258
|
const currentRefreshToken = await this.getRefreshToken();
|
|
259
259
|
if (!currentRefreshToken) {
|
|
@@ -345,6 +345,10 @@ class StandardLogtoClient {
|
|
|
345
345
|
}
|
|
346
346
|
return this.getAccessToken(undefined, organizationId);
|
|
347
347
|
}
|
|
348
|
+
async #clearAccessToken() {
|
|
349
|
+
this.accessTokenMap.clear();
|
|
350
|
+
await this.adapter.storage.removeItem('accessToken');
|
|
351
|
+
}
|
|
348
352
|
async #handleSignInCallback(callbackUri) {
|
|
349
353
|
const signInSession = await this.getSignInSession();
|
|
350
354
|
if (!signInSession) {
|