mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Remove unusable tenants (#9921)
This commit is contained in:
@@ -219,12 +219,14 @@ export abstract class AzureAuth implements vscode.Disposable {
|
|||||||
console.log('Base token was empty, account is stale.');
|
console.log('Base token was empty, account is stale.');
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await this.refreshAccessToken(account.key, baseToken.refreshToken, tenant, resource);
|
await this.refreshAccessToken(account.key, baseToken.refreshToken, tenant, resource);
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
console.log(ex);
|
console.log(`Could not refresh access token for ${JSON.stringify(tenant)} - silently removing the tenant from the user's account.`);
|
||||||
account.isStale = true;
|
azureAccount.properties.tenants = azureAccount.properties.tenants.filter(t => t.id !== tenant.id);
|
||||||
return undefined;
|
console.log(ex, ex?.data, ex?.response);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
cachedTokens = await this.getCachedToken(account.key, resource.id, tenant.id);
|
cachedTokens = await this.getCachedToken(account.key, resource.id, tenant.id);
|
||||||
@@ -243,9 +245,12 @@ export abstract class AzureAuth implements vscode.Disposable {
|
|||||||
|
|
||||||
if (azureAccount.properties.subscriptions) {
|
if (azureAccount.properties.subscriptions) {
|
||||||
azureAccount.properties.subscriptions.forEach(subscription => {
|
azureAccount.properties.subscriptions.forEach(subscription => {
|
||||||
|
// Make sure that tenant has information populated.
|
||||||
|
if (response[subscription.tenantId]) {
|
||||||
response[subscription.id] = {
|
response[subscription.id] = {
|
||||||
...response[subscription.tenantId]
|
...response[subscription.tenantId]
|
||||||
};
|
};
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user