* Log out * * This method removes all stored tokens and stops the refresh timer.
()
| 362 | * This method removes all stored tokens and stops the refresh timer. |
| 363 | */ |
| 364 | public async logout(): Promise<void> { |
| 365 | const oldCredentials = this.credentials |
| 366 | |
| 367 | try { |
| 368 | // Clear credentials from storage - onDidChange will handle state transitions |
| 369 | await this.clearCredentials() |
| 370 | await this.context.globalState.update(AUTH_STATE_KEY, undefined) |
| 371 | |
| 372 | if (oldCredentials) { |
| 373 | try { |
| 374 | await this.clerkLogout(oldCredentials) |
| 375 | } catch (error) { |
| 376 | this.log("[auth] Error calling clerkLogout:", error) |
| 377 | } |
| 378 | } |
| 379 | |
| 380 | const vscode = await importVscode() |
| 381 | |
| 382 | if (vscode) { |
| 383 | vscode.window.showInformationMessage("Logged out from Roo Code Cloud") |
| 384 | } |
| 385 | |
| 386 | this.log("[auth] Logged out from Roo Code Cloud") |
| 387 | } catch (error) { |
| 388 | this.log(`[auth] Error logging out from Roo Code Cloud: ${error}`) |
| 389 | throw new Error(`Failed to log out from Roo Code Cloud: ${error}`) |
| 390 | } |
| 391 | } |
| 392 | |
| 393 | public getState(): AuthState { |
| 394 | return this.state |
nothing calls this directly
no test coverage detected