diff --git a/apps/web/src/app/billing/organizations/sm-subscribe-standalone.component.ts b/apps/web/src/app/billing/organizations/sm-subscribe-standalone.component.ts index ebde4ab253..521600163f 100644 --- a/apps/web/src/app/billing/organizations/sm-subscribe-standalone.component.ts +++ b/apps/web/src/app/billing/organizations/sm-subscribe-standalone.component.ts @@ -1,6 +1,7 @@ import { Component, EventEmitter, Input, Output } from "@angular/core"; import { FormBuilder } from "@angular/forms"; +import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { OrganizationApiServiceAbstraction } from "@bitwarden/common/admin-console/abstractions/organization/organization-api.service.abstraction"; import { InternalOrganizationServiceAbstraction } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction"; import { OrganizationData } from "@bitwarden/common/admin-console/models/data/organization.data"; @@ -26,6 +27,7 @@ export class SecretsManagerSubscribeStandaloneComponent { formGroup = secretsManagerSubscribeFormFactory(this.formBuilder); constructor( + private apiService: ApiService, private formBuilder: FormBuilder, private platformUtilsService: PlatformUtilsService, private i18nService: I18nService, @@ -52,7 +54,17 @@ export class SecretsManagerSubscribeStandaloneComponent { }); await this.organizationService.upsert(organizationData); - this.platformUtilsService.showToast("success", null, this.i18nService.t("subscriptionUpdated")); + /* + Because subscribing to Secrets Manager automatically provides access to Secrets Manager for the + subscribing user, we need to refresh the identity token to account for their updated permissions. + */ + await this.apiService.refreshIdentityToken(); + + this.platformUtilsService.showToast( + "success", + null, + this.i18nService.t("subscribedToSecretsManager") + ); this.onSubscribe.emit(); }; diff --git a/apps/web/src/locales/en/messages.json b/apps/web/src/locales/en/messages.json index 9caf99e796..3f44be2376 100644 --- a/apps/web/src/locales/en/messages.json +++ b/apps/web/src/locales/en/messages.json @@ -3464,6 +3464,9 @@ "subscriptionUpdated": { "message": "Subscription updated" }, + "subscribedToSecretsManager": { + "message": "Subscription updated. You now have access to Secrets Manager." + }, "additionalOptions": { "message": "Additional options" },