[PR #512] [MERGED] auth_code_pkce: add from_token_with_config() constructor #504

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

📋 Pull Request Information

Original PR: https://github.com/ramsayleung/rspotify/pull/512
Author: @gdesmott
Created: 12/29/2024
Status: Merged
Merged: 12/29/2024
Merged by: @ramsayleung

Base: masterHead: pkce


📝 Commits (1)

  • a9c14b5 auth_code_pkce: add from_token_with_config() constructor

📊 Changes

2 files changed (+19 additions, -0 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 src/auth_code_pkce.rs (+18 -0)

📄 Description

Description

Add AuthCodePkceSpotify::from_token_with_config()

Motivation and Context

This is required to be able to refresh an expired token from the cache as we need the client ID to refresh the token.

Fix #511

Dependencies

None

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How has this been tested?

  • Call a AuthCodePkceSpotify using with_config() and
Config {
        token_cached: true,
        token_refreshing: true,
        ..Default::default()
    };
  • Authenticate using the normal flow.
  • Terminate the app and wait for one hour for the token to expired.
  • Restore the token using Token::from_cache() and check that token.is_expired() returns true.
  • Create a client with AuthCodePkceSpotify::from_token() and then call client.refresh_token(). The client won't work as the token has not been refresh. You can also check by calling client.refetch_token() as it returns None.
  • Now create a client using AuthCodePkceSpotify::from_token_with_config() passing the proper Credentials. client.refresh_token() and client.refetch_token() are now working.

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/512 **Author:** [@gdesmott](https://github.com/gdesmott) **Created:** 12/29/2024 **Status:** ✅ Merged **Merged:** 12/29/2024 **Merged by:** [@ramsayleung](https://github.com/ramsayleung) **Base:** `master` ← **Head:** `pkce` --- ### 📝 Commits (1) - [`a9c14b5`](https://github.com/ramsayleung/rspotify/commit/a9c14b5bb9251f104e6185d971bc0f58f3a63802) auth_code_pkce: add from_token_with_config() constructor ### 📊 Changes **2 files changed** (+19 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `src/auth_code_pkce.rs` (+18 -0) </details> ### 📄 Description ## Description Add `AuthCodePkceSpotify::from_token_with_config()` ## Motivation and Context This is required to be able to refresh an expired token from the cache as we need the client ID to refresh the token. Fix #511 ## Dependencies None ## Type of change Please delete options that are not relevant. - [x] Bug fix (non-breaking change which fixes an issue) ## How has this been tested? - Call a `AuthCodePkceSpotify` using `with_config()` and ```rust Config { token_cached: true, token_refreshing: true, ..Default::default() }; ``` - Authenticate using the normal flow. - Terminate the app and wait for one hour for the token to expired. - Restore the token using `Token::from_cache()` and check that `token.is_expired()` returns `true`. - Create a client with `AuthCodePkceSpotify::from_token()` and then call `client.refresh_token()`. The client won't work as the token has not been refresh. You can also check by calling `client.refetch_token()` as it returns `None`. - Now create a client using `AuthCodePkceSpotify::from_token_with_config()` passing the proper `Credentials`. `client.refresh_token()` and `client.refetch_token()` are now working. ## 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:58 +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#504
No description provided.