[PR #513] [MERGED] Spawn a local Tcplistener to handle the callback url #505

Closed
opened 2026-02-27 20:24:59 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ramsayleung/rspotify/pull/513
Author: @ramsayleung
Created: 12/30/2024
Status: Merged
Merged: 1/1/2025
Merged by: @ramsayleung

Base: masterHead: ramsay/add_tcplistern_for_callback


📝 Commits (9)

  • dab6f74 Spawn a local Tcplistener to handle the callback url rather than copy/paste URL into the terminal.
  • 2494c67 Add CHANGELOG and fix cargo clippy error.
  • 7360347 Rollback .env to fix failed tests.
  • ab0cfc4 Mark artist_related_artists, track_features, tracks_features as deprecated because Spotify has deprecated these endpoints
  • 48e1780 Fix the CI problem that Url.socket_addr method doesn't exist in wasm architecture.
  • dbb4198 Fix cargo format error.
  • f2f22ef Remove unnecessary debug statement.
  • e20e08c Complete the description of CHANGELOG.
  • 8efda38 Add the missing endpoint back into the description of CHANGELOG.

📊 Changes

6 files changed (+186 additions, -68 deletions)

View changed files

📝 .env (+3 -3)
📝 CHANGELOG.md (+3 -0)
📝 src/clients/base.rs (+16 -0)
📝 src/clients/oauth.rs (+147 -10)
📝 src/lib.rs (+16 -0)
📝 tests/test_with_credential.rs (+1 -55)

📄 Description

Description

  • Spawn a local TCPListener to handle callback url rather manually copy/paste into terminal for better deverloper experience.
  • Mark artist_related_artists, track_features, tracks_features as deprecated because Spotify has deprecated these endpoints and delete related tests as Spotify will return 403 to these deprecated endpoints.

Acknowledge:

This solution of TCPListener is highly inspired by librespot.

Motivation and Context

Dependencies

None

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How has this been tested?

  • unit test: get_socket_address_none, get_socket_address_localhost
  • run me example with redirect url: http://127.0.0.1: 8000/callback, open in the webbrowser and automatically connect to local TCPListener, work without human interaction.

image
image

Is this change properly documented?

Yes.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ramsayleung/rspotify/pull/513 **Author:** [@ramsayleung](https://github.com/ramsayleung) **Created:** 12/30/2024 **Status:** ✅ Merged **Merged:** 1/1/2025 **Merged by:** [@ramsayleung](https://github.com/ramsayleung) **Base:** `master` ← **Head:** `ramsay/add_tcplistern_for_callback` --- ### 📝 Commits (9) - [`dab6f74`](https://github.com/ramsayleung/rspotify/commit/dab6f74a73560657f5fcbce0dfc29313eaf771da) Spawn a local Tcplistener to handle the callback url rather than copy/paste URL into the terminal. - [`2494c67`](https://github.com/ramsayleung/rspotify/commit/2494c67fe954afb3897a0550a65b98ab6eddb2fe) Add CHANGELOG and fix cargo clippy error. - [`7360347`](https://github.com/ramsayleung/rspotify/commit/7360347a7e2956ce3128c0e2d6267b1fca2572bb) Rollback .env to fix failed tests. - [`ab0cfc4`](https://github.com/ramsayleung/rspotify/commit/ab0cfc4724287093c302a60419a42fcd96b51c7d) Mark `artist_related_artists`, `track_features`, `tracks_features` as deprecated because Spotify has deprecated these endpoints - [`48e1780`](https://github.com/ramsayleung/rspotify/commit/48e17809b7d16bc387e0a66109fa2412e070743b) Fix the CI problem that Url.socket_addr method doesn't exist in wasm architecture. - [`dbb4198`](https://github.com/ramsayleung/rspotify/commit/dbb41981939f048df1386bfd8eb86401eac9ba85) Fix cargo format error. - [`f2f22ef`](https://github.com/ramsayleung/rspotify/commit/f2f22efca678050b06de56026bba3cf29031794d) Remove unnecessary debug statement. - [`e20e08c`](https://github.com/ramsayleung/rspotify/commit/e20e08cdf74fa9800626ca3158308c834a2ec0fc) Complete the description of CHANGELOG. - [`8efda38`](https://github.com/ramsayleung/rspotify/commit/8efda38a483dbd39e18f0bfaf7ab6ff040ab55db) Add the missing endpoint back into the description of CHANGELOG. ### 📊 Changes **6 files changed** (+186 additions, -68 deletions) <details> <summary>View changed files</summary> 📝 `.env` (+3 -3) 📝 `CHANGELOG.md` (+3 -0) 📝 `src/clients/base.rs` (+16 -0) 📝 `src/clients/oauth.rs` (+147 -10) 📝 `src/lib.rs` (+16 -0) 📝 `tests/test_with_credential.rs` (+1 -55) </details> ### 📄 Description ## Description - Spawn a local TCPListener to handle callback url rather manually copy/paste into terminal for better deverloper experience. - Mark `artist_related_artists`, `track_features`, `tracks_features` as deprecated because Spotify has deprecated these endpoints and delete related tests as Spotify will return 403 to these deprecated endpoints. Acknowledge: This solution of TCPListener is highly inspired by [librespot](https://github.com/librespot-org/librespot/blob/dev/oauth/src/lib.rs#L107). ## Motivation and Context - https://github.com/ramsayleung/rspotify/issues/417 - https://github.com/ramsayleung/rspotify/discussions/365 ## Dependencies None ## Type of change Please delete options that are not relevant. - [ ] Bug fix (non-breaking change which fixes an issue) - [x] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [x] This change requires a documentation update ## How has this been tested? - [x] unit test: `get_socket_address_none`, `get_socket_address_localhost` - [x] run `me` example with redirect url: `http://127.0.0.1: 8000/callback`, open in the webbrowser and automatically connect to local TCPListener, work without human interaction. ![image](https://github.com/user-attachments/assets/bb5f3edb-3124-4d3f-a345-c54b48e3326b) ![image](https://github.com/user-attachments/assets/5f700bf9-e254-4bf6-94c9-ec0c73eca862) ## Is this change properly documented? Yes. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 20:24:59 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/rspotify#505
No description provided.