confluentinc / vscode

Confluent for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=confluentinc.vscode-confluent
Apache License 2.0
13 stars 3 forks source link

[v0.21.x] fix: update CCloud auth status "secret" on reauthentication #615

Open shouples opened 2 days ago

shouples commented 2 days ago

Summary of Changes

Follow-up to #566 where our middleware may be using a stale auth status "secret" set by the poller.

After a user reauthenticates through CCloud, there is a short period of time (before the auth poller sets the correct VALID_TOKEN status) where a CCloud-related request can be made and our middleware will pick up the old (usually FAILED) status and invalidate the auth session, leading to a misleading state that flashes the sidebar between CCloud-connected/-disconnected.

https://github.com/user-attachments/assets/56ffaa56-e89f-42ef-94b1-7c68891550e0

Now, the CCloud auth provider will explicitly update the secret after a successful (re)authentication (and similarly explicitly delete the secret during a sign-out event), which will then prevent the middleware from incorrectly invalidating the CCloud auth session from the extension's perspective:

https://github.com/user-attachments/assets/913f0382-e9c7-4eaf-a819-a85423a3f552

Pull request checklist

Please check if your PR fulfills the following (if applicable):

Tests
Other