Fix Gemini OAuth onboarding failure (#8905)
Signed-off-by: Angie Jones <jones.angie@gmail.com>
This commit is contained in:
@@ -303,11 +303,15 @@ struct LoadCodeAssistResponse {
|
|||||||
cloudaicompanion_project: Option<String>,
|
cloudaicompanion_project: Option<String>,
|
||||||
current_tier: Option<TierInfo>,
|
current_tier: Option<TierInfo>,
|
||||||
onboard_tiers: Option<Vec<TierInfo>>,
|
onboard_tiers: Option<Vec<TierInfo>>,
|
||||||
|
allowed_tiers: Option<Vec<TierInfo>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
struct TierInfo {
|
struct TierInfo {
|
||||||
id: Option<String>,
|
id: Option<String>,
|
||||||
|
#[serde(default)]
|
||||||
|
is_default: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
@@ -424,7 +428,15 @@ async fn setup_code_assist(access_token: &str) -> Result<String> {
|
|||||||
.as_ref()
|
.as_ref()
|
||||||
.and_then(|tiers| tiers.first())
|
.and_then(|tiers| tiers.first())
|
||||||
.and_then(|t| t.id.clone())
|
.and_then(|t| t.id.clone())
|
||||||
.unwrap_or_else(|| "FREE".to_string());
|
.or_else(|| {
|
||||||
|
load_resp
|
||||||
|
.allowed_tiers
|
||||||
|
.as_ref()
|
||||||
|
.and_then(|tiers| tiers.iter().find(|t| t.is_default.unwrap_or(false)))
|
||||||
|
.or_else(|| load_resp.allowed_tiers.as_ref().and_then(|t| t.first()))
|
||||||
|
.and_then(|t| t.id.clone())
|
||||||
|
})
|
||||||
|
.unwrap_or_else(|| "free-tier".to_string());
|
||||||
|
|
||||||
tracing::info!("Onboarding user with tier: {}", tier_id);
|
tracing::info!("Onboarding user with tier: {}", tier_id);
|
||||||
|
|
||||||
|
|||||||
@@ -213,9 +213,16 @@ export default function ProviderConfigurationModal({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await configureProviderOauth({
|
const oauthResult = await configureProviderOauth({
|
||||||
path: { name: provider.name },
|
path: { name: provider.name },
|
||||||
});
|
});
|
||||||
|
if (oauthResult.error) {
|
||||||
|
const err = oauthResult.error as Record<string, unknown>;
|
||||||
|
const errDetail = typeof oauthResult.error === 'string'
|
||||||
|
? oauthResult.error
|
||||||
|
: (err?.message as string) ?? (err?.detail as string) ?? JSON.stringify(oauthResult.error);
|
||||||
|
throw new Error(errDetail);
|
||||||
|
}
|
||||||
if (onConfigured) {
|
if (onConfigured) {
|
||||||
onConfigured(provider);
|
onConfigured(provider);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user