# Onairos Flutter Package - YouTube Integration Setup

## 📱 **YouTube Integration Setup**

To enable YouTube integration in your app using the Onairos package, you need to configure Google credentials that match your app's bundle ID.

> **Note**: If YouTube integration isn't working or shows "unavailable", follow this setup guide. Other platforms (Instagram, Reddit, Pinterest, LinkedIn) work without additional setup.

## 🔧 **Setup Instructions - 3 Steps**

### **Step 1: Create Google Cloud Project**
1. Go to [Google Cloud Console](https://console.cloud.google.com/)
2. Create a new project or select existing project
3. Enable **YouTube Data API v3**:
   - Go to APIs & Services → Library
   - Search for "YouTube Data API v3"
   - Click "Enable"

### **Step 2: Create OAuth Credentials**
1. Go to APIs & Services → Credentials
2. Click "Create Credentials" → "OAuth 2.0 Client IDs"
3. Create credentials for your platforms:

**For iOS:**
- Application type: iOS
- Bundle ID: Your app's bundle identifier (e.g., `com.yourcompany.yourapp`)

**For Android:**
- Application type: Android
- Package name: Your app's package name
- SHA-1 certificate fingerprint (see below)

4. Download the configuration files:
   - **iOS**: `GoogleService-Info.plist`
   - **Android**: `google-services.json`

### **Step 3: Configure Your App**

**Add configuration files:**
- **iOS**: Place `GoogleService-Info.plist` in `ios/Runner/` directory
- **Android**: Place `google-services.json` in `android/app/` directory

**Update your Onairos widget:**
```dart
Onairos(
  AppName: 'Your App Name',
  googleClientId: 'YOUR_CLIENT_ID.apps.googleusercontent.com', // From your Google Cloud Console
  onResolved: (apiUrl, token, userData) {
    // Handle successful connection
    print('Connected with token: $token');
  },
)
```

**Find your Client ID:**
1. In Google Cloud Console → APIs & Services → Credentials
2. Copy the "Client ID" from your OAuth 2.0 client
3. It should look like: `123456789-abcdef.apps.googleusercontent.com`

## 🔑 **Get SHA-1 Certificate (Android)**

**For debug builds:**
```bash
keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
```

**For release builds:**
```bash
keytool -list -v -keystore YOUR_RELEASE_KEYSTORE -alias YOUR_ALIAS
```

Copy the SHA-1 fingerprint and add it to your Android OAuth client in Google Cloud Console.

## 📱 **Platform Status**

| Platform | Setup Required | Status |
|----------|----------------|--------|
| **Instagram** | None | ✅ Ready to use |
| **Reddit** | None | ✅ Ready to use |
| **Pinterest** | None | ✅ Ready to use |
| **LinkedIn** | None | ✅ Ready to use |
| **YouTube** | Google credentials | ⚙️ Requires setup |

## ✅ **Testing Your Setup**

1. **Before setup**: YouTube will show "Setup required" message
2. **After setup**: YouTube should connect normally
3. **Wrong configuration**: Clear error messages will guide you

## 🆘 **Troubleshooting**

**"YouTube setup required"**
→ Normal if you haven't configured Google credentials yet

**"Google Sign-In failed"** 
→ Check that your bundle ID/package name matches your OAuth client configuration

**"Invalid client ID"**
→ Ensure you're using your own client ID, not the demo one

**YouTube connector not appearing**
→ Verify your `googleClientId` parameter is set correctly

## 📚 **Need More Help?**

- **Detailed setup**: See [CONSUMING_APP_SETUP_GUIDE.md](CONSUMING_APP_SETUP_GUIDE.md)
- **API documentation**: See [API_STATUS_SUMMARY.md](API_STATUS_SUMMARY.md)

---

**Without YouTube setup**: Your app will work perfectly with Instagram, Reddit, Pinterest, and LinkedIn. YouTube will simply show as "unavailable" until configured. 