You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am generating a URL for the user to log into via
use dotenvy::dotenv;use spotify_rs::{AuthCodeClient,AuthCodeFlow,ClientCredsClient,ClientCredsFlow,RedirectUrl};use std::{env, error::Error};#[tokio::main]asyncfn main() -> Result<(),Box<dynError>>{// This should match the redirect URI you set in your app's settingslet redirect_url = RedirectUrl::new("http://localhost:3000".to_owned()).unwrap();let auto_refresh = true;let scopes = vec!["user-library-read", "playlist-read-private"];let _ = dotenv();let client_secret = env::var("spotify_client_secret").expect("CLIENT_SECRET must be set");let auth_code_flow =
AuthCodeFlow::new("0079fab38fc74726ac22609e5f996898", client_secret, scopes);// Redirect the user to this URL to get the auth code and CSRF tokenlet(client, url) = AuthCodeClient::new(auth_code_flow, redirect_url, auto_refresh);println!("Please visit this URL: {}", url);
After clicking the URL, and manually logging in, I am redirected to: http://localhost:3000/?code=...&state=... (where ... are codes.
I am passing code to "auth_code" and state to "csrf_token", in the
Hey! Sorry for getting to it so late.
I was indeed able to reproduce this, using io::stdin.read_line() to read the code. I assume you were using it too?
Anyway, the issue in this case was that an \r\n was appended at the end of the code. It's fixed now. Thanks!
I am generating a URL for the user to log into via
After clicking the URL, and manually logging in, I am redirected to:
http://localhost:3000/?code=...&state=...
(where...
are codes.I am passing
code
to"auth_code"
andstate
to"csrf_token"
, in thefunction. But as a result I get
Is this an error in this lib or am I doing something wrong?
The text was updated successfully, but these errors were encountered: