Skip to content

Migrate off httr to tinyoauth (curl + serverSocket)#6

Merged
TroyHernandez merged 5 commits into
masterfrom
tinyoauth-migration
Jun 8, 2026
Merged

Migrate off httr to tinyoauth (curl + serverSocket)#6
TroyHernandez merged 5 commits into
masterfrom
tinyoauth-migration

Conversation

@TroyHernandez

Copy link
Copy Markdown
Collaborator

Replaces tinyspotifyr's httr backend with tinyoauth.

What changed

  • Auth (authenticate.R): get_spotify_access_token() (client-credentials) and get_spotify_authorization_code() (user flow, cache + refresh) now run on tinyoauth. An existing httr .httr-oauth is carried over via tinyoauth::oauth_import_httr()no re-login, so MixtapeR/lc40 keep working.
  • All endpoints: every httr::RETRY/GET/content/config/stop_for_status replaced by tinyoauth::oauth_request() (Bearer header, retry, JSON parse).
  • Dependencies: Imports trimmed from httr, jsonlite to tinyoauth alone (curl + jsonlite live under tinyoauth). httr's ~9 recursive deps gone.
  • Bug fixes: two pre-existing latent bugs surfaced by live testing — get_artist() (id= typo) and get_album() (stray undefined playlist_id line). Both errored only at call time, so were never caught.

Verification

  • R CMD check: 0 errors, 0 notes (1 WARNING = the maintainer-change carried from 0.2.3).
  • Live-tested ~15 endpoints against Spotify (catalog, user-scoped, search, browse, paginated, both auth styles) with a real user token — all pass.

⚠️ Merge/CRAN gating

tinyoauth isn't on CRAN yet, so this is on a branch with Remotes: cornball-ai/tinyoauth. Do not CRAN-submit until tinyoauth is published. Installs fine from GitHub now. CI may be red until tinyoauth is on CRAN (r-ci won't resolve the Remotes dep).

- authenticate.R: client-credentials + user flow via tinyoauth, with
  oauth_import_httr() carrying over an existing .httr-oauth (no re-login)
- tracks.R: endpoints use tinyoauth::oauth_request (no httr RETRY/content)
- DESCRIPTION: Imports tinyoauth + Remotes; Depends R (>= 4.0); httr/jsonlite
  kept until the remaining endpoint files are migrated
- Verified live: get_spotify_access_token() + get_track()
- All endpoint files use tinyoauth::oauth_request (Bearer header, retry, JSON
  parse); removed httr RETRY/GET/content/config/stop_for_status everywhere
- authenticate.R on tinyoauth with oauth_import_httr() .httr-oauth carry-over
- DESCRIPTION: Imports trimmed to tinyoauth only (dropped httr + jsonlite),
  Remotes: cornball-ai/tinyoauth; package doc imports dropped
- Fixed two pre-existing latent bugs surfaced by live testing:
  get_artist() 'id=' typo and get_album() stray undefined playlist_id line
- Verified live across ~15 endpoints (catalog, user, search, browse, paginated)
* Fix get_shows_episodes() sending market twice

market was baked into the URL (?market=) and ALSO passed via query=,
so tinyoauth::oauth_request()'s paste0(url, '?', qs) produced
'.../episodes?market=US?market=US'. Spotify parsed the market as
'US?market=US' and returned HTTP 400 'Invalid market parameter'. Build
the path only and let oauth_request add the query, matching the other
shows.R functions.

* Bump version to 0.2.3.2
@TroyHernandez TroyHernandez merged commit d10441c into master Jun 8, 2026
4 checks passed
@TroyHernandez TroyHernandez deleted the tinyoauth-migration branch June 8, 2026 16:15
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.

1 participant