team-2/CHALLENGE_2/sleepysound/SPOTIFY_SETUP.md
2025-08-02 04:16:15 +02:00

2.2 KiB

Spotify API Setup Instructions

🎵 Getting Spotify API Credentials

To enable real Spotify integration in SleepySound, you need to set up a Spotify Developer account and get API credentials.

Step 1: Create a Spotify Developer Account

  1. Go to Spotify Developer Dashboard
  2. Log in with your Spotify account (create one if needed)
  3. Accept the Terms of Service

Step 2: Create a New App

  1. Click "Create an App"
  2. Fill in the details:
    • App Name: SleepySound
    • App Description: Collaborative music selection for Lido Schenna
    • Redirect URI: sleepysound://callback
  3. Check the boxes to agree to terms
  4. Click "Create"

Step 3: Get Your Credentials

  1. In your app dashboard, you'll see:
    • Client ID (public)
    • Client Secret (keep this private!)
  2. Copy these values

Step 4: Configure the App

  1. Open lib/services/spotify_service.dart
  2. Replace the placeholder values:
    static const String _clientId = 'YOUR_ACTUAL_CLIENT_ID_HERE';
    static const String _clientSecret = 'YOUR_ACTUAL_CLIENT_SECRET_HERE';
    

Step 5: Enable Spotify Features

The app is configured to work with mock data by default. Once you add real credentials:

  • Real Spotify search will be enabled
  • Track metadata will be fetched from Spotify
  • Album artwork will be displayed
  • Preview URLs will be available (if provided by Spotify)

🚀 Demo Mode

The app works without Spotify credentials using demo data. You can:

  • Search for tracks (returns demo results)
  • Vote on songs
  • See the queue update in real-time
  • Experience the full UI/UX

🔒 Security Notes

  • Never commit your Client Secret to version control
  • In production, use environment variables or secure storage
  • Consider using Spotify's Authorization Code flow for user-specific features

📱 Features Enabled with Spotify API

  • Real track search
  • Album artwork
  • Accurate track duration
  • Artist information
  • Track previews (where available)
  • External Spotify links

🎯 Challenge Requirements Met

  • Music streaming API integration (Spotify)
  • Track metadata retrieval
  • Demo-ready functionality
  • Real-world usability

Enjoy building your collaborative music experience! 🎶