@logto/client 2.6.2 → 2.6.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/lib/client.cjs +6 -6
- package/lib/client.d.ts +1 -0
- package/lib/client.js +6 -6
- package/package.json +1 -1
package/lib/client.cjs
CHANGED
|
@@ -180,6 +180,7 @@ class StandardLogtoClient {
|
|
|
180
180
|
this.setSignInSession({ redirectUri, postRedirectUri, codeVerifier, state }),
|
|
181
181
|
this.setRefreshToken(null),
|
|
182
182
|
this.setIdToken(null),
|
|
183
|
+
this.clearAccessToken(),
|
|
183
184
|
]);
|
|
184
185
|
await this.adapter.navigate(signInUri, { redirectUri, for: 'sign-in' });
|
|
185
186
|
}
|
|
@@ -227,12 +228,7 @@ class StandardLogtoClient {
|
|
|
227
228
|
postLogoutRedirectUri,
|
|
228
229
|
clientId,
|
|
229
230
|
});
|
|
230
|
-
this.
|
|
231
|
-
await Promise.all([
|
|
232
|
-
this.setRefreshToken(null),
|
|
233
|
-
this.setIdToken(null),
|
|
234
|
-
this.adapter.storage.removeItem('accessToken'),
|
|
235
|
-
]);
|
|
231
|
+
await Promise.all([this.setRefreshToken(null), this.setIdToken(null), this.clearAccessToken()]);
|
|
236
232
|
await this.adapter.navigate(url, { redirectUri: postLogoutRedirectUri, for: 'sign-out' });
|
|
237
233
|
}
|
|
238
234
|
async getSignInSession() {
|
|
@@ -255,6 +251,10 @@ class StandardLogtoClient {
|
|
|
255
251
|
async setRefreshToken(value) {
|
|
256
252
|
return this.adapter.setStorageItem(types.PersistKey.RefreshToken, value);
|
|
257
253
|
}
|
|
254
|
+
async clearAccessToken() {
|
|
255
|
+
this.accessTokenMap.clear();
|
|
256
|
+
await this.adapter.storage.removeItem('accessToken');
|
|
257
|
+
}
|
|
258
258
|
async getAccessTokenByRefreshToken(resource, organizationId) {
|
|
259
259
|
const currentRefreshToken = await this.getRefreshToken();
|
|
260
260
|
if (!currentRefreshToken) {
|
package/lib/client.d.ts
CHANGED
|
@@ -183,6 +183,7 @@ export declare class StandardLogtoClient {
|
|
|
183
183
|
protected setSignInSession(value: Nullable<LogtoSignInSessionItem>): Promise<void>;
|
|
184
184
|
private setIdToken;
|
|
185
185
|
private setRefreshToken;
|
|
186
|
+
private clearAccessToken;
|
|
186
187
|
private getAccessTokenByRefreshToken;
|
|
187
188
|
private saveAccessTokenMap;
|
|
188
189
|
private loadAccessTokenMap;
|
package/lib/client.js
CHANGED
|
@@ -178,6 +178,7 @@ class StandardLogtoClient {
|
|
|
178
178
|
this.setSignInSession({ redirectUri, postRedirectUri, codeVerifier, state }),
|
|
179
179
|
this.setRefreshToken(null),
|
|
180
180
|
this.setIdToken(null),
|
|
181
|
+
this.clearAccessToken(),
|
|
181
182
|
]);
|
|
182
183
|
await this.adapter.navigate(signInUri, { redirectUri, for: 'sign-in' });
|
|
183
184
|
}
|
|
@@ -225,12 +226,7 @@ class StandardLogtoClient {
|
|
|
225
226
|
postLogoutRedirectUri,
|
|
226
227
|
clientId,
|
|
227
228
|
});
|
|
228
|
-
this.
|
|
229
|
-
await Promise.all([
|
|
230
|
-
this.setRefreshToken(null),
|
|
231
|
-
this.setIdToken(null),
|
|
232
|
-
this.adapter.storage.removeItem('accessToken'),
|
|
233
|
-
]);
|
|
229
|
+
await Promise.all([this.setRefreshToken(null), this.setIdToken(null), this.clearAccessToken()]);
|
|
234
230
|
await this.adapter.navigate(url, { redirectUri: postLogoutRedirectUri, for: 'sign-out' });
|
|
235
231
|
}
|
|
236
232
|
async getSignInSession() {
|
|
@@ -253,6 +249,10 @@ class StandardLogtoClient {
|
|
|
253
249
|
async setRefreshToken(value) {
|
|
254
250
|
return this.adapter.setStorageItem(PersistKey.RefreshToken, value);
|
|
255
251
|
}
|
|
252
|
+
async clearAccessToken() {
|
|
253
|
+
this.accessTokenMap.clear();
|
|
254
|
+
await this.adapter.storage.removeItem('accessToken');
|
|
255
|
+
}
|
|
256
256
|
async getAccessTokenByRefreshToken(resource, organizationId) {
|
|
257
257
|
const currentRefreshToken = await this.getRefreshToken();
|
|
258
258
|
if (!currentRefreshToken) {
|