[PR #252] [MERGED] Fixes cached tokens #344

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

📋 Pull Request Information

Original PR: https://github.com/ramsayleung/rspotify/pull/252
Author: @marioortizmanero
Created: 9/19/2021
Status: Merged
Merged: 9/20/2021
Merged by: @ramsayleung

Base: masterHead: fix-token-read


📝 Commits (2)

📊 Changes

2 files changed (+23 additions, -10 deletions)

View changed files

📝 src/client_creds.rs (+6 -3)
📝 src/clients/oauth.rs (+17 -7)

📄 Description

Description

This fixes:

  • prompt_for_user, which failed when read_token_cache returned and error. The problem here is that we are expecting an error in case the cache file isn't found (FileNotFoundError). We just want to ignore it, but it used ?, which caused an early return. So the match expression just accepts Ok(Some()) now.
  • read_token_cache for OAuth clients didn't check the config. Whoops

I also updated the docs to make them more exhaustive.

Motivation and Context

This was caused by #250

Dependencies

None

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • This change requires a documentation update

How Has This Been Tested?

If you remove all cached tokens in your main directory and try to run any example it won't work. Now it does. This is because prompt_user_token returned FileNotFound and propagated. For example try with:

cargo run --example auth_code --features="env-file,cli"

🔄 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/252 **Author:** [@marioortizmanero](https://github.com/marioortizmanero) **Created:** 9/19/2021 **Status:** ✅ Merged **Merged:** 9/20/2021 **Merged by:** [@ramsayleung](https://github.com/ramsayleung) **Base:** `master` ← **Head:** `fix-token-read` --- ### 📝 Commits (2) - [`854369c`](https://github.com/ramsayleung/rspotify/commit/854369c3aeff1b55caca8690bc5e14ff11ff4fa3) Fix token reading with prompt utility - [`ae30eae`](https://github.com/ramsayleung/rspotify/commit/ae30eae6636ec7236c3c3ee56aca2ad110d6bbe4) Fix docs ### 📊 Changes **2 files changed** (+23 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `src/client_creds.rs` (+6 -3) 📝 `src/clients/oauth.rs` (+17 -7) </details> ### 📄 Description ## Description This fixes: * `prompt_for_user`, which failed when `read_token_cache` returned and error. The problem here is that we *are* expecting an error in case the cache file isn't found (`FileNotFoundError`). We just want to ignore it, but it used `?`, which caused an early return. So the `match` expression just accepts `Ok(Some())` now. * `read_token_cache` for OAuth clients didn't check the config. Whoops I also updated the docs to make them more exhaustive. ## Motivation and Context This was caused by #250 ## Dependencies None ## Type of change Please delete options that are not relevant. - [x] Bug fix (non-breaking change which fixes an issue) - [x] This change requires a documentation update ## How Has This Been Tested? If you remove all cached tokens in your main directory and try to run any example it won't work. Now it does. This is because `prompt_user_token` returned `FileNotFound` and propagated. For example try with: ``` cargo run --example auth_code --features="env-file,cli" ``` --- <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:20 +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#344
No description provided.