diff --git a/src/infrastructure/api.rs b/src/infrastructure/api.rs index 298400b..8497988 100644 --- a/src/infrastructure/api.rs +++ b/src/infrastructure/api.rs @@ -81,16 +81,11 @@ impl ApiClient { )); } - let mut params = serde_json::json!({ + let params = serde_json::json!({ "client_id": self.client_id, "scope": "https://www.googleapis.com/auth/tasks", }); - // Some client types require client_secret in the initial request - if !self.client_secret.is_empty() { - params["client_secret"] = serde_json::Value::String(self.client_secret.clone()); - } - let resp = self .client .post("https://oauth2.googleapis.com/device/code") @@ -113,11 +108,17 @@ impl ApiClient { let mut msg = format!("OAuth error ({}): {} - {}", status, err_code, err_desc); - // Common fixes for known errors - if err_desc.contains("Invalid client") || err_code == "invalid_client" { + if err_code == "invalid_client" || err_desc.contains("Invalid client") { msg.push_str( - ". Check that you created a 'Desktop app' OAuth 2.0 Client ID in Google Cloud Console \ - (not 'Web application'). Also verify that Google Tasks API is enabled.", + "\n\nPossible fixes (Google Cloud Console):\n\ + 1. APIs & Services > Library -> Enable 'Google Tasks API'.\n\ + 2. APIs & Services > OAuth consent screen:\n\ + - Set 'Publishing status' to 'Testing'\n\ + - Add 'https://www.googleapis.com/auth/tasks' to Scopes\n\ + - Add your email under 'Test users'\n\ + 3. APIs & Services > Credentials:\n\ + - Create new OAuth 2.0 Client ID of type 'Desktop app'\n\ + - Copy the Client ID and Client Secret exactly (no extra spaces)", ); }