Skip to content

Add Spotify widget with OAuth integration#18

Draft
Copilot wants to merge 4 commits intomainfrom
copilot/add-spotify-widget
Draft

Add Spotify widget with OAuth integration#18
Copilot wants to merge 4 commits intomainfrom
copilot/add-spotify-widget

Conversation

Copy link
Contributor

Copilot AI commented Nov 7, 2025

Adds a Spotify widget that displays the current player state and user playlists. The widget prompts for authentication via Spotify OAuth, then shows the active track with album art and playback controls, or recently played tracks when idle.

Authentication

  • Added Spotify provider to Auth.js with required scopes (user-read-playback-state, playlist-read-private, etc.)
  • Session callbacks now store Spotify access/refresh tokens alongside GitHub credentials
  • Guarded token assignments to prevent undefined errors

API Endpoint

  • /api/spotify fetches current player state, playlists (limit 10), and recently played tracks (limit 5)
  • Handles 204 No Content responses when nothing is playing
  • Returns 401 for unauthenticated requests

Widget Component

Three states: unauthenticated (connect prompt), loading, and connected (player + playlists grid)

  • Auto-refreshes player state every 10 seconds
  • Displays up to 6 playlists with album art and track counts
  • Falls back to recently played when no active playback

Configuration

Updated .env.example and README with Spotify OAuth setup instructions. Widget type definition extended to include 'spotify' and added to default widget set in store.

Screenshot

Spotify Widget - Connect Prompt

Shows the unauthenticated state with Spotify-branded connect button. Once connected, displays active track details or recently played content with playlist grid below.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • workers.cloudflare.com
    • Triggering command: node /home/REDACTED/work/dashboard/dashboard/node_modules/.bin/vite build (dns block)
    • Triggering command: node /home/REDACTED/work/dashboard/dashboard/node_modules/.bin/vite dev --host 0.0.0.0 --port 5173 (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Spotify widget</issue_title>
<issue_description>Add a Spotify widget that shows the player and the recent playlists of the current user.

The user should be able to log in or connect their Spotify account.

The widget should only show the prompt to log in / connect until they have connected, then show the player and the recents.</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: davis9001 <72961+davis9001@users.noreply.github.com>
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Nov 7, 2025

Deploying dashboard with  Cloudflare Pages  Cloudflare Pages

Latest commit: cd1d8dc
Status: ✅  Deploy successful!
Preview URL: https://c5ec3467.dashboard-eyz.pages.dev
Branch Preview URL: https://copilot-add-spotify-widget.dashboard-eyz.pages.dev

View logs

Copilot AI and others added 2 commits November 7, 2025 17:00
Co-authored-by: davis9001 <72961+davis9001@users.noreply.github.com>
Co-authored-by: davis9001 <72961+davis9001@users.noreply.github.com>
Copilot AI changed the title [WIP] Add Spotify widget to display player and recent playlists Add Spotify widget with OAuth integration Nov 7, 2025
Copilot AI requested a review from davis9001 November 7, 2025 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Spotify widget

2 participants