Trigger auth status update on secret storage change (#4837)

* Trigger auth status update on secret storage change

The auth status should be updated when the clineAccountId secret changes. This commit adds a listener to the secrets.onDidChange event and calls sendAuthStatusUpdate when the clineAccountId secret changes. This ensures that the auth status is always up-to-date.

* restore

* afgain

---------

Co-authored-by: abeatrix <beatrix@cline.bot>
This commit is contained in:
Beeandabeatrix authored and GitHub committed 2025-07-11 12:53:24 -07:00
1 parent c38f443ec4
commit 17200740a8
2 files changed
+10 -1

No files matched your search

+8
View File
@@ -685,6 +685,14 @@ export async function activate(context: vscode.ExtensionContext) {
}),
)
context.subscriptions.push(
context.secrets.onDidChange((event) => {
if (event.key === "clineAccountId") {
AuthService.getInstance(context)?.restoreAuthToken()
}
}),
)
return createClineAPI(outputChannel, sidebarWebview.controller)
}
+2 -1
View File
@@ -100,6 +100,7 @@ export class AuthService {
})
this._setProvider(authProviders.find((authProvider) => authProvider.name === providerName).name)
this._context = context
}
@@ -118,7 +119,7 @@ export class AuthService {
}
AuthService.instance = new AuthService(context, config || {}, authProvider)
}
if (context) {
if (context !== undefined) {
AuthService.instance.context = context
}
return AuthService.instance