[PR #693] [MERGED] Implement Login5 Authorization #665

Closed
opened 2026-02-28 14:33:48 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/jpochyla/psst/pull/693
Author: @Pogodaanton
Created: 9/21/2025
Status: Merged
Merged: 11/16/2025
Merged by: @jacksongoode

Base: mainHead: feat/login5-prototype


📝 Commits (10+)

  • 01e94f4 feat: Add rudimentary login5 auth implementation
  • 82cb6e4 fix: Enable login5 as access_token source for psst-gui
  • 9abd1c1 fix: Enable login5 as access_token source for psst-core cdn
  • 330b377 fix: Add token expiry check to login5 and spclient
  • bc9609f refactor: Consolidate client token usage and system info relevant constants
  • 84f9b41 fix: Send correct system info to client token service
  • a44184d refactor: Simplify token struct
  • c5291a1 chore: Remove excessive logging
  • e13aa2d Review changes
  • 587e8ca Clippy lints

📊 Changes

19 files changed (+821 additions, -93 deletions)

View changed files

📝 Cargo.lock (+151 -22)
📝 psst-core/Cargo.toml (+6 -0)
📝 psst-core/src/cdn.rs (+6 -5)
📝 psst-core/src/error.rs (+8 -0)
📝 psst-core/src/lib.rs (+1 -0)
📝 psst-core/src/player/queue.rs (+2 -7)
psst-core/src/session/client_token.rs (+252 -0)
psst-core/src/session/login5.rs (+283 -0)
📝 psst-core/src/session/mod.rs (+3 -0)
psst-core/src/session/token.rs (+20 -0)
psst-core/src/system_info.rs (+12 -0)
📝 psst-core/src/util.rs (+45 -4)
📝 psst-gui/src/data/album.rs (+2 -7)
📝 psst-gui/src/data/config.rs (+8 -26)
📝 psst-gui/src/data/mod.rs (+4 -8)
📝 psst-gui/src/data/promise.rs (+3 -6)
📝 psst-gui/src/data/track.rs (+3 -0)
📝 psst-gui/src/data/utils.rs (+1 -0)
📝 psst-gui/src/webapi/client.rs (+11 -8)

📄 Description

Retrieving an access_token over Keymaster broke a while ago. The librespot folks alleviated the auth question by resorting to the Login5 interface instead. This pull-request ports the necessary code for Auth5 to work in psst-core.

Implementation Considerations

Protobuf

The new Auth5 interface requires a lot of new protobuf messages. While we could plug them into psst-protocol, I realized that the current .proto files in psst haven't been touched for 5 years. I could not even get the pb-rs build script to work without having to edit the existing protobuf files. I'm sure I could eventually figure out the build process, however, Librespot already provides their protobuf code in a neat package (librespot-protocol). I propose slowly moving our code to use it instead.

Dependencies

As I am quite a beginner regarding Rust, I have ported the code in a rudimentary way. I pulled in quite a few more dependencies from librespot to make the code work. We need to look into whether we can replace them with existing dependencies.

PR State

The PR is in a reviewable state. All the features I wished to implement are included now. This includes:

  • auth5 interface for retrieving access token via stored credentials
  • client token requesting interface for auth5 and potential future features
  • caching for auth5 and client tokens; cached tokens are refreshed after their predetermined expiry time

TODOs

  • Real world testing on platforms other than Windows (need help)
  • Token expiry/refresh testing. I currently did not see the tokens expire even in long listening sessions.
  • Assess new dependencies: Can we replace them with existing ones?

Fixes #687


🔄 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/jpochyla/psst/pull/693 **Author:** [@Pogodaanton](https://github.com/Pogodaanton) **Created:** 9/21/2025 **Status:** ✅ Merged **Merged:** 11/16/2025 **Merged by:** [@jacksongoode](https://github.com/jacksongoode) **Base:** `main` ← **Head:** `feat/login5-prototype` --- ### 📝 Commits (10+) - [`01e94f4`](https://github.com/jpochyla/psst/commit/01e94f44898b0206bf390164136502f03691239e) feat: Add rudimentary login5 auth implementation - [`82cb6e4`](https://github.com/jpochyla/psst/commit/82cb6e4b3e8fefd7b9d4419a108ef6f42ff5cdd8) fix: Enable login5 as access_token source for psst-gui - [`9abd1c1`](https://github.com/jpochyla/psst/commit/9abd1c188a53cf9681da020136a287750fef33ce) fix: Enable login5 as access_token source for psst-core cdn - [`330b377`](https://github.com/jpochyla/psst/commit/330b377f37e27c07f869fab10aefff9a32da46db) fix: Add token expiry check to login5 and spclient - [`bc9609f`](https://github.com/jpochyla/psst/commit/bc9609faac8d8914cd3539c3a962d034d8a522b7) refactor: Consolidate client token usage and system info relevant constants - [`84f9b41`](https://github.com/jpochyla/psst/commit/84f9b413f4bde23e2f5bfc5a81dca9baf28747ef) fix: Send correct system info to client token service - [`a44184d`](https://github.com/jpochyla/psst/commit/a44184d193906d0b0769b345eee96d419eb50bdf) refactor: Simplify token struct - [`c5291a1`](https://github.com/jpochyla/psst/commit/c5291a1a11e03754433c8728b9b6a38ee2a59602) chore: Remove excessive logging - [`e13aa2d`](https://github.com/jpochyla/psst/commit/e13aa2d9b71d4ed32f2c4d7345b2344cfbe67b1b) Review changes - [`587e8ca`](https://github.com/jpochyla/psst/commit/587e8ca8b50b852067ef4238815d0e07159bf8f7) Clippy lints ### 📊 Changes **19 files changed** (+821 additions, -93 deletions) <details> <summary>View changed files</summary> 📝 `Cargo.lock` (+151 -22) 📝 `psst-core/Cargo.toml` (+6 -0) 📝 `psst-core/src/cdn.rs` (+6 -5) 📝 `psst-core/src/error.rs` (+8 -0) 📝 `psst-core/src/lib.rs` (+1 -0) 📝 `psst-core/src/player/queue.rs` (+2 -7) ➕ `psst-core/src/session/client_token.rs` (+252 -0) ➕ `psst-core/src/session/login5.rs` (+283 -0) 📝 `psst-core/src/session/mod.rs` (+3 -0) ➕ `psst-core/src/session/token.rs` (+20 -0) ➕ `psst-core/src/system_info.rs` (+12 -0) 📝 `psst-core/src/util.rs` (+45 -4) 📝 `psst-gui/src/data/album.rs` (+2 -7) 📝 `psst-gui/src/data/config.rs` (+8 -26) 📝 `psst-gui/src/data/mod.rs` (+4 -8) 📝 `psst-gui/src/data/promise.rs` (+3 -6) 📝 `psst-gui/src/data/track.rs` (+3 -0) 📝 `psst-gui/src/data/utils.rs` (+1 -0) 📝 `psst-gui/src/webapi/client.rs` (+11 -8) </details> ### 📄 Description Retrieving an `access_token` over Keymaster broke a while ago. The librespot folks alleviated the auth question by [resorting to the Login5](https://github.com/librespot-org/librespot/issues/1532#issuecomment-3188123661) interface instead. This pull-request ports the necessary code for Auth5 to work in `psst-core`. ## Implementation Considerations ### Protobuf The new Auth5 interface requires a lot of new protobuf messages. While we could plug them into `psst-protocol`, I realized that the current `.proto` files in psst haven't been touched for 5 years. I could not even get the `pb-rs` build script to work without having to edit the existing protobuf files. I'm sure I could eventually figure out the build process, however, Librespot already provides their protobuf code in a neat package (`librespot-protocol`). I propose slowly moving our code to use it instead. ### Dependencies As I am quite a beginner regarding Rust, I have ported the code in a rudimentary way. I pulled in quite a few more dependencies from librespot to make the code work. We need to look into whether we can replace them with existing dependencies. ## PR State The PR is in a reviewable state. All the features I wished to implement are included now. This includes: - auth5 interface for retrieving access token via stored credentials - client token requesting interface for auth5 and potential future features - caching for auth5 and client tokens; cached tokens are refreshed after their predetermined expiry time ### TODOs - [x] Real world testing on platforms other than Windows (need help) - [x] Token expiry/refresh testing. I currently did not see the tokens expire even in long listening sessions. - [ ] Assess new dependencies: Can we replace them with existing ones? Fixes #687 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-28 14:33:48 +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/psst#665
No description provided.