[GH-ISSUE #205] Error parsing token_info #69

Closed
opened 2026-02-27 20:22:55 +03:00 by kerem · 4 comments
Owner

Originally created by @rstcologne on GitHub (Apr 20, 2021).
Original GitHub issue: https://github.com/ramsayleung/rspotify/issues/205

Describe the bug
I'm trying to run one of the very simple example programs providing my own clilent_id and secret (not pasted here, replaced below with my_client_id and my_secret_key).

extern crate rspotify;

use rspotify::client::Spotify;
use rspotify::oauth2::SpotifyClientCredentials;
use rspotify::senum::Country;

#[tokio::main]
async fn main() {
    // Set client_id and client_secret in .env file or
    // export CLIENT_ID="your client_id"
    // export CLIENT_SECRET="secret"
    //let client_credential = SpotifyClientCredentials::default().build();


    // Or set client_id and client_secret explictly
    let client_credential = SpotifyClientCredentials::default()
         .client_id("my_client_id")
         .client_secret("my_secret_key")
         .build();
    let spotify = Spotify::default()
        .client_credentials_manager(client_credential)
        .build();
    let birdy_uri = "spotify:artist:2WX2uTcsvV5OnS0inACecP";

    let tracks = spotify
        .artist_top_tracks(birdy_uri, Country::UnitedStates)
        .await;
    
    println!("{:?}", tracks.unwrap());
}

To Reproduce
Steps to reproduce the behavior:
compile and run

Expected behavior
println! at the end sending output to the console

Log/Output data
thread 'main' panicked at 'Error parsing token_info response: reqwest::Error { kind: Decode, source: Error("missing field scope", line: 1, column: 142) }', /home/rst/.cargo/registry/src/github.com-1ecc6299db9ec823/rspotify-0.10.0/src/oauth2.rs:475:14

Additional context
Please bear with me, I'm learning rust, so I might be doing something wrong here but I figured, I'd get at least and example program to run :-)

Originally created by @rstcologne on GitHub (Apr 20, 2021). Original GitHub issue: https://github.com/ramsayleung/rspotify/issues/205 **Describe the bug** I'm trying to run one of the very simple example programs providing my own clilent_id and secret (not pasted here, replaced below with my_client_id and my_secret_key). ``` extern crate rspotify; use rspotify::client::Spotify; use rspotify::oauth2::SpotifyClientCredentials; use rspotify::senum::Country; #[tokio::main] async fn main() { // Set client_id and client_secret in .env file or // export CLIENT_ID="your client_id" // export CLIENT_SECRET="secret" //let client_credential = SpotifyClientCredentials::default().build(); // Or set client_id and client_secret explictly let client_credential = SpotifyClientCredentials::default() .client_id("my_client_id") .client_secret("my_secret_key") .build(); let spotify = Spotify::default() .client_credentials_manager(client_credential) .build(); let birdy_uri = "spotify:artist:2WX2uTcsvV5OnS0inACecP"; let tracks = spotify .artist_top_tracks(birdy_uri, Country::UnitedStates) .await; println!("{:?}", tracks.unwrap()); } ``` **To Reproduce** Steps to reproduce the behavior: compile and run **Expected behavior** println! at the end sending output to the console **Log/Output data** thread 'main' panicked at 'Error parsing token_info response: reqwest::Error { kind: Decode, source: Error("missing field `scope`", line: 1, column: 142) }', /home/rst/.cargo/registry/src/github.com-1ecc6299db9ec823/rspotify-0.10.0/src/oauth2.rs:475:14 **Additional context** Please bear with me, I'm learning rust, so I might be doing something wrong here but I figured, I'd get at least and example program to run :-)
kerem 2026-02-27 20:22:55 +03:00
Author
Owner

@ramsayleung commented on GitHub (Apr 22, 2021):

It seems there is something wrong your cache token, would you like to post it here. The default cache token would be /your-project-path/.spotify_token_cache.json.

<!-- gh-comment-id:824510445 --> @ramsayleung commented on GitHub (Apr 22, 2021): It seems there is something wrong your cache token, would you like to post it here. The default cache token would be `/your-project-path/.spotify_token_cache.json`.
Author
Owner

@amPerl commented on GitHub (Apr 23, 2021):

Also seeing this as I'm converting an old python project over to rspotify. I don't think the request for TokenInfo always returns a scope, specifically when there are none requested for fetching non-user data like the issue author is.

edit: works fine on master, running off that now

<!-- gh-comment-id:825698737 --> @amPerl commented on GitHub (Apr 23, 2021): Also seeing this as I'm converting an old python project over to `rspotify`. I don't think the request for `TokenInfo` always returns a `scope`, specifically when there are none requested for fetching non-user data like the issue author is. edit: works fine on `master`, running off that now
Author
Owner

@ramsayleung commented on GitHub (Apr 28, 2021):

@rstcologne As amPerl pointed out, you could give the master branch for a try, since we have been working on it for months to make it easier to use.

<!-- gh-comment-id:828474079 --> @ramsayleung commented on GitHub (Apr 28, 2021): @rstcologne As amPerl pointed out, you could give the `master` branch for a try, since we have been working on it for months to make it easier to use.
Author
Owner

@marioortizmanero commented on GitHub (Jul 8, 2021):

Closing as this has already been fixed.

<!-- gh-comment-id:876378270 --> @marioortizmanero commented on GitHub (Jul 8, 2021): Closing as this has already been fixed.
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#69
No description provided.