-
-
Notifications
You must be signed in to change notification settings - Fork 232
feat: add auth_port configuration option #1657
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I was wondering whether the port selection should happen automatically? Another thing I was wondering about whether freely choosing a port is OK? When registering an API client, the user needs to specify a callback URL and I'm uncertain if we can freely choose the port. Did you test this?
src/authentication.rs
Outdated
pub fn get_client_redirect_uri(configuration: &Config) -> Result<String, String> { | ||
let auth_port = configuration.values().auth_port.unwrap_or(8989).to_string(); | ||
let redirect_url = format!("http://127.0.0.1:{auth_port}/login"); | ||
Ok(redirect_url) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ins 8000 tead of configuring the port, should ncspot pick a free port automatically maybe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried that, if we remove the port it gives back a prompt where you enter the URL manually:
let redirect_url = format!("http://127.0.0.1/login");
Browse to: https://accounts.spotify.com/authorize?response_type=code&client_id=65b708073fc0480ea92a077233ca87bd&state=TiFVv25QeINX7InxhQjIqA&code_challenge=QLMUWfMSejnKrBxkpqIZu-2RA3EScy25c8xZ1OXmp10&code_challenge_method=S256&redirect_uri=http%3A%2F%2F127.0.0.1%2Flogin&scope=playlist-modify+playlist-modify-private+playlist-modify-public+playlist-read+playlist-read-collaborative+playlist-read-private+streaming+user-follow-modify+user-follow-read+user-library-modify+user-library-read+user-modify+user-modify-playback-state+user-modify-private+user-personalized+user-read-currently-playing+user-read-email+user-read-play-history+user-read-playback-position+user-read-playback-state+user-read-private+user-read-recently-played+user-top-read
Provide redirect URL
hi
Unable to parse redirect URI hi (relative URL without a base)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, what I meant was have ncspot pick a value for auth_port
automatically.
Signed-off-by: Elias Assaf <elyas51000@gmail.com>
Describe your changes
Add a configuration option to set the authenticate port, by default its 8989
Issue ticket number and link
#1637
Checklist before requesting a review
not performance improvements, etc.)