Conversation
- 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>
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds Spotify Web API as a standard OAuth 2.0 Authorization Code connector.
Changes
apps/web/src/lib/apps/spotify.ts): newAppDefinitionwith inlinebuildAuthUrl/exchangeCode(no shared Spotify helpers exist). Uses HTTP Basic client auth on the token endpoint as documented. Fetches/v1/mefor username/email/display-name/avatar metadata.user-read-email,user-read-private,user-library-read,playlist-read-private,playlist-read-collaborative,user-top-read,user-read-recently-played.apps/gateway/src/apps.rs):AppProviderforapi.spotify.comwithBearerstrategy.ClientAuthMethodenum onRefreshConfig(BodyvsBasic), per Spotify's refresh-tokens docs which require HTTP Basic on/api/tokenfor the Authorization Code flow.GOOGLE_REFRESHkeepsBody(form-encoded credentials);SPOTIFY_REFRESHusesBasic(reqwest::basic_auth).providers_for_spotify_host,spotify_api_uses_bearer,spotify_refresh_uses_basic_auth,google_refresh_uses_body_auth.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/0minus private ranges).Test plan
pnpm --filter @onecli/web lint— cleanpnpm --filter @onecli/web check-types— cleancargo test apps::— all 30 tests passSPOTIFY_CLIENT_ID/SPOTIFY_CLIENT_SECRET, complete OAuth, hithttps://api.spotify.com/v1/mevia the gateway, let the access token expire and verify refresh works