fix(auth): await OAuth storage load() to fix remote OAuth races
This commit is contained in:
parent
7bd26c938e
commit
a24091484c
2 changed files with 245 additions and 133 deletions
|
|
@ -3064,8 +3064,8 @@ export class InspectorClient extends InspectorClientEventTarget {
|
|||
/**
|
||||
* Clears OAuth tokens and client information
|
||||
*/
|
||||
clearOAuthTokens(): void {
|
||||
this.oauthManager?.clearOAuthTokens();
|
||||
async clearOAuthTokens(): Promise<void> {
|
||||
await this.oauthManager?.clearOAuthTokens();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -282,6 +282,8 @@ export class OAuthManager {
|
|||
iss?: string,
|
||||
): Promise<void> {
|
||||
try {
|
||||
await this.requireStorage().load();
|
||||
|
||||
if (this.isEnterpriseManaged()) {
|
||||
const scopeForMint =
|
||||
this.pendingAuthorizationScope ?? this.getEmaFlowConfig().scope;
|
||||
|
|
@ -387,13 +389,13 @@ export class OAuthManager {
|
|||
}
|
||||
}
|
||||
|
||||
clearOAuthTokens(): void {
|
||||
async clearOAuthTokens(): Promise<void> {
|
||||
if (!this.oauthConfig?.storage) {
|
||||
return;
|
||||
}
|
||||
|
||||
const serverUrl = this.getServerUrl();
|
||||
this.oauthConfig.storage.clear(serverUrl);
|
||||
await this.oauthConfig.storage.clear(serverUrl);
|
||||
|
||||
this.oauthFlowState = null;
|
||||
this.pendingAuthorizationScope = undefined;
|
||||
|
|
|
|||
Loading…
Reference in a new issue