even more aggressive custom token fetching + storing in apiConfig

This commit is contained in:
pashpashpash
2025-02-08 20:37:29 -08:00
parent 5a3a9f1392
commit 82d9385b8b
2 changed files with 12 additions and 5 deletions
+1
View File
@@ -1003,6 +1003,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
...apiConfiguration,
apiProvider: clineProvider,
clineApiKey: apiKey,
authToken: customToken,
}
if (this.cline) {
+11 -5
View File
@@ -200,16 +200,22 @@ export class FirebaseAuthManager {
}
private async restoreSession() {
console.log("Attempting to restore session")
console.log("[restoreSession] Attempting to restore session")
const provider = this.providerRef.deref()
if (!provider) {
console.log("Provider reference lost during session restore")
console.log("[restoreSession] Provider reference lost during session restore")
return
}
// If no active session, try to sign in with stored custom token
const storedToken = await provider.getSecret("authToken")
if (storedToken) {
// Get the auth state from the provider's state, which is loaded when the webview launches
const { apiConfiguration } = await provider.getState()
const storedToken = apiConfiguration?.authToken
console.log("[restoreSession] Auth state from provider:", {
hasToken: !!storedToken,
hasClineApiKey: !!apiConfiguration?.clineApiKey,
})
if (storedToken && apiConfiguration?.clineApiKey) {
console.log("Found stored custom token, attempting to restore session")
try {
await this.retryWithBackoff(async () => {