[GH-ISSUE #23] Displays authentication warning message even after successful authentication #7

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

Originally created by @ritiek on GitHub (Oct 29, 2018).
Original GitHub issue: https://github.com/ramsayleung/rspotify/issues/23

Hi, thanks for this cool library.

I launched the album_tracks.rs example and it works fine but it displays this warning:

    You need to set your Spotify API credentials. You can do this by
    setting environment variables in `.env` file:
    CLIENT_ID='your-spotify-client-id'
    CLIENT_SECRET='your-spotify-client-secret'
    REDIRECT_URI='your-app-redirect-url'
    Get your credentials at `https://developer.spotify.com/my-applications`

I tried it both with exporting CLIENT_ID and CLIENT_SECRET environment variables, and also setting them explicitly in my test crate but it still displays this warning.

Complete output
SpotifyClientCredentials.default(): client_id:"mah_client_id", client_secret:"mah_client_secret"
SpotifyClientCredentials.default(): client_id:"mah_client_id", client_secret:"mah_client_secret" empty_flag:true

    You need to set your Spotify API credentials. You can do this by
    setting environment variables in `.env` file:
    CLIENT_ID='your-spotify-client-id'
    CLIENT_SECRET='your-spotify-client-secret'
    REDIRECT_URI='your-app-redirect-url'
    Get your credentials at `https://developer.spotify.com/my-applications`
Ok(Page { href: "https://api.spotify.com/v1/albums/6akEvsycLGftJxYudPjmqK/tracks?offset=0&limit=2", items: [SimplifiedTrack { artists: [SimplifiedArtist { external_urls:
{"spotify": "https://open.spotify.com/artist/08td7MxkoHQkXnWAYD8d6Q"}, href: "https://api.spotify.com/v1/artists/08td7MxkoHQkXnWAYD8d6Q", id: "08td7MxkoHQkXnWAYD8d6Q", name: "Tania Bowra", _type: artist, uri: "spotify:artist:08td7MxkoHQkXnWAYD8d6Q" }], available_markets: Some(["AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CA", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "ID", "IE", "IL", "IS", "IT", "JP", "LI", "LT", "LU", "LV", "MC", "MT", "MX", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SK", "SV", "TH", "TR", "TW", "US", "UY", "VN", "ZA"]), disc_number: 1, duration_ms: 276773, explicit: false, external_urls: {"spotify": "https://open.spotify.com/track/2TpxZ7JUBn3uw46aR7qd6V"}, href: "https://api.spotify.com/v1/tracks/2TpxZ7JUBn3uw46aR7qd6V", id: "2TpxZ7JUBn3uw46aR7qd6V", name: "All I Want", preview_url: Some("https://p.scdn.co/mp3-preview/12b8cee72118f995f5494e1b34251e4ac997445e?cid=feebf12513c448a383739f9fdadc7dbc"), track_number: 1, _type: track, uri: "spotify:track:2TpxZ7JUBn3uw46aR7qd6V" }, SimplifiedTrack { artists: [SimplifiedArtist { external_urls: {"spotify": "https://open.spotify.com/artist/08td7MxkoHQkXnWAYD8d6Q"}, href: "https://api.spotify.com/v1/artists/08td7MxkoHQkXnWAYD8d6Q", id: "08td7MxkoHQkXnWAYD8d6Q", name: "Tania Bowra", _type: artist, uri: "spotify:artist:08td7MxkoHQkXnWAYD8d6Q" }], available_markets: Some(["AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CA", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "ID", "IE", "IL", "IS", "IT", "JP", "LI", "LT", "LU", "LV", "MC", "MT", "MX", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SK", "SV", "TH", "TR", "TW", "US", "UY", "VN", "ZA"]), disc_number: 1, duration_ms: 247680, explicit: false, external_urls: {"spotify": "https://open.spotify.com/track/4PjcfyZZVE10TFd9EKA72r"}, href: "https://api.spotify.com/v1/tracks/4PjcfyZZVE10TFd9EKA72r", id: "4PjcfyZZVE10TFd9EKA72r", name: "Someday", preview_url: Some("https://p.scdn.co/mp3-preview/4a54d83c195d0bc17b1b23fc931d37fb363224d8?cid=feebf12513c448a383739f9fdadc7dbc"), track_number: 2, _type: track, uri: "spotify:track:4PjcfyZZVE10TFd9EKA72r" }], limit: 2, next: Some("https://api.spotify.com/v1/albums/6akEvsycLGftJxYudPjmqK/tracks?offset=2&limit=2"), offset: 0, previous: None, total: 11 })

Is this warning expected or does this needs fixing?
Originally created by @ritiek on GitHub (Oct 29, 2018). Original GitHub issue: https://github.com/ramsayleung/rspotify/issues/23 Hi, thanks for this cool library. I launched the [album_tracks.rs](https://github.com/samrayleung/rspotify/blob/06676398bfcc7cc4a267241dcdda2503c510a88e/examples/album_tracks.rs) example and it works fine but it displays this warning: ``` You need to set your Spotify API credentials. You can do this by setting environment variables in `.env` file: CLIENT_ID='your-spotify-client-id' CLIENT_SECRET='your-spotify-client-secret' REDIRECT_URI='your-app-redirect-url' Get your credentials at `https://developer.spotify.com/my-applications` ``` I tried it both with exporting `CLIENT_ID` and `CLIENT_SECRET` environment variables, and also setting them explicitly in my test crate but it still displays this warning. <details> <summary>Complete output</summary> ``` SpotifyClientCredentials.default(): client_id:"mah_client_id", client_secret:"mah_client_secret" SpotifyClientCredentials.default(): client_id:"mah_client_id", client_secret:"mah_client_secret" empty_flag:true You need to set your Spotify API credentials. You can do this by setting environment variables in `.env` file: CLIENT_ID='your-spotify-client-id' CLIENT_SECRET='your-spotify-client-secret' REDIRECT_URI='your-app-redirect-url' Get your credentials at `https://developer.spotify.com/my-applications` Ok(Page { href: "https://api.spotify.com/v1/albums/6akEvsycLGftJxYudPjmqK/tracks?offset=0&limit=2", items: [SimplifiedTrack { artists: [SimplifiedArtist { external_urls: {"spotify": "https://open.spotify.com/artist/08td7MxkoHQkXnWAYD8d6Q"}, href: "https://api.spotify.com/v1/artists/08td7MxkoHQkXnWAYD8d6Q", id: "08td7MxkoHQkXnWAYD8d6Q", name: "Tania Bowra", _type: artist, uri: "spotify:artist:08td7MxkoHQkXnWAYD8d6Q" }], available_markets: Some(["AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CA", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "ID", "IE", "IL", "IS", "IT", "JP", "LI", "LT", "LU", "LV", "MC", "MT", "MX", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SK", "SV", "TH", "TR", "TW", "US", "UY", "VN", "ZA"]), disc_number: 1, duration_ms: 276773, explicit: false, external_urls: {"spotify": "https://open.spotify.com/track/2TpxZ7JUBn3uw46aR7qd6V"}, href: "https://api.spotify.com/v1/tracks/2TpxZ7JUBn3uw46aR7qd6V", id: "2TpxZ7JUBn3uw46aR7qd6V", name: "All I Want", preview_url: Some("https://p.scdn.co/mp3-preview/12b8cee72118f995f5494e1b34251e4ac997445e?cid=feebf12513c448a383739f9fdadc7dbc"), track_number: 1, _type: track, uri: "spotify:track:2TpxZ7JUBn3uw46aR7qd6V" }, SimplifiedTrack { artists: [SimplifiedArtist { external_urls: {"spotify": "https://open.spotify.com/artist/08td7MxkoHQkXnWAYD8d6Q"}, href: "https://api.spotify.com/v1/artists/08td7MxkoHQkXnWAYD8d6Q", id: "08td7MxkoHQkXnWAYD8d6Q", name: "Tania Bowra", _type: artist, uri: "spotify:artist:08td7MxkoHQkXnWAYD8d6Q" }], available_markets: Some(["AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CA", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "ID", "IE", "IL", "IS", "IT", "JP", "LI", "LT", "LU", "LV", "MC", "MT", "MX", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SK", "SV", "TH", "TR", "TW", "US", "UY", "VN", "ZA"]), disc_number: 1, duration_ms: 247680, explicit: false, external_urls: {"spotify": "https://open.spotify.com/track/4PjcfyZZVE10TFd9EKA72r"}, href: "https://api.spotify.com/v1/tracks/4PjcfyZZVE10TFd9EKA72r", id: "4PjcfyZZVE10TFd9EKA72r", name: "Someday", preview_url: Some("https://p.scdn.co/mp3-preview/4a54d83c195d0bc17b1b23fc931d37fb363224d8?cid=feebf12513c448a383739f9fdadc7dbc"), track_number: 2, _type: track, uri: "spotify:track:4PjcfyZZVE10TFd9EKA72r" }], limit: 2, next: Some("https://api.spotify.com/v1/albums/6akEvsycLGftJxYudPjmqK/tracks?offset=2&limit=2"), offset: 0, previous: None, total: 11 }) ``` </details> <br> Is this warning expected or does this needs fixing?
kerem closed this issue 2026-02-27 20:22:35 +03:00
Author
Owner

@ramsayleung commented on GitHub (Oct 30, 2018):

it needs to fix, I am too busy to take time fix this problem. Perhaps you could help me fix it :)

<!-- gh-comment-id:434276402 --> @ramsayleung commented on GitHub (Oct 30, 2018): it needs to fix, I am too busy to take time fix this problem. Perhaps you could help me fix it :)
Author
Owner

@ritiek commented on GitHub (Oct 30, 2018):

No problem! I'll see if I can give it a shot.

<!-- gh-comment-id:434277980 --> @ritiek commented on GitHub (Oct 30, 2018): No problem! I'll see if I can give it a shot. >
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#7
No description provided.