fix(auth): route clearClientInformation through clearAfterHydration too
Round-2 @claude review of #1592 caught a seventh member of the clear family that the first pass missed: clearClientInformation still wrote to the store synchronously, carrying the same pre-hydration clobber risk the clearAfterHydration helper was written for (a clear before hydration lands persists a near-empty blob, overwriting the whole on-disk oauth.json). Wrap its mutation the same way and add a clear-before-hydration test proving a sibling token (and thus every other server's blob) survives. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S3fTN8H3R8YV4yUGvZjYnX
This commit is contained in:
parent
8c10b8eb8e
commit
4e149719bd
1 changed files with 32 additions and 10 deletions
|
|
@ -172,16 +172,16 @@ export class OAuthStorageBase implements OAuthStorage {
|
|||
}
|
||||
|
||||
clearClientInformation(serverUrl: string, isPreregistered?: boolean): void {
|
||||
const updates: Partial<ServerOAuthState> = {};
|
||||
|
||||
if (isPreregistered) {
|
||||
updates.preregisteredClientInformation = undefined;
|
||||
} else {
|
||||
updates.clientInformation = undefined;
|
||||
updates.clientRegistrationKind = undefined;
|
||||
}
|
||||
|
||||
this.store.getState().setServerState(serverUrl, updates);
|
||||
this.clearAfterHydration(() => {
|
||||
const updates: Partial<ServerOAuthState> = {};
|
||||
if (isPreregistered) {
|
||||
updates.preregisteredClientInformation = undefined;
|
||||
} else {
|
||||
updates.clientInformation = undefined;
|
||||
updates.clientRegistrationKind = undefined;
|
||||
}
|
||||
this.store.getState().setServerState(serverUrl, updates);
|
||||
});
|
||||
}
|
||||
|
||||
async getTokens(serverUrl: string): Promise<OAuthTokens | undefined> {
|
||||
|
|
|
|||
Loading…
Reference in a new issue