Skip to content

feat(apps): add Spotify connector#12

Merged
jezekra1 merged 1 commit intomainfrom
feat/spotify-connector
Apr 19, 2026
Merged

feat(apps): add Spotify connector#12
jezekra1 merged 1 commit intomainfrom
feat/spotify-connector

Conversation

@jezekra1
Copy link
Copy Markdown

Summary

Adds Spotify Web API as a standard OAuth 2.0 Authorization Code connector.

Changes

  • Web (apps/web/src/lib/apps/spotify.ts): new AppDefinition with inline buildAuthUrl / exchangeCode (no shared Spotify helpers exist). Uses HTTP Basic client auth on the token endpoint as documented. Fetches /v1/me for username/email/display-name/avatar metadata.
    • Default scopes (read-only): user-read-email, user-read-private, user-library-read, playlist-read-private, playlist-read-collaborative, user-top-read, user-read-recently-played.
  • Gateway (apps/gateway/src/apps.rs):
    • New AppProvider for api.spotify.com with Bearer strategy.
    • Introduces a ClientAuthMethod enum on RefreshConfig (Body vs Basic), per Spotify's refresh-tokens docs which require HTTP Basic on /api/token for the Authorization Code flow.
    • GOOGLE_REFRESH keeps Body (form-encoded credentials); SPOTIFY_REFRESH uses Basic (reqwest::basic_auth).
    • Tests: providers_for_spotify_host, spotify_api_uses_bearer, spotify_refresh_uses_basic_auth, google_refresh_uses_body_auth.
  • Icon: apps/web/public/icons/spotify.svg (Spotify green circle with the signature curves).

No NetworkPolicy change needed in consumers (egress already allows 0.0.0.0/0 minus private ranges).

Test plan

  • pnpm --filter @onecli/web lint — clean
  • pnpm --filter @onecli/web check-types — clean
  • cargo test apps:: — all 30 tests pass
  • Manual: register a Spotify app, set SPOTIFY_CLIENT_ID/SPOTIFY_CLIENT_SECRET, complete OAuth, hit https://api.spotify.com/v1/me via the gateway, let the access token expire and verify refresh works

- Web: new OAuth AppDefinition for Spotify with read-oriented default
  scopes (profile, library, playlists, top/recent)
- Gateway: route api.spotify.com via Bearer auth and extend RefreshConfig
  with ClientAuthMethod to support Spotify's required HTTP Basic client
  auth on /api/token (Google remains on form-body credentials)

Signed-off-by: Radek Ježek <radek.jezek@ibm.com>
@jezekra1 jezekra1 merged commit 3ace5b1 into main Apr 19, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants