[GH-ISSUE #130] Introduce automatic token retrieval #44

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

Originally created by @hypixus on GitHub (Sep 25, 2020).
Original GitHub issue: https://github.com/ramsayleung/rspotify/issues/130

This is a feature request.

This project works perfectly, but as I'm trying to create application where user interacts only with generated GUI, i'm in no way capable of providing the URL user is redirected to after allowing application to use their data - because command line is off the limits, and this is hardcoded into the library ("Enter the URL you were redirected to: ")

A very simple solution would be implementing http server going with localhost:, where user is redirected to and application is just reading the data off the request directly (just like in Listing 20-2 on rust cookbook).

If this is already implemented/has a possible workaround without rebuilding entire library, please let me know - I'll close the issue immediately.

Originally created by @hypixus on GitHub (Sep 25, 2020). Original GitHub issue: https://github.com/ramsayleung/rspotify/issues/130 This is a feature request. This project works perfectly, but as I'm trying to create application where user interacts only with generated GUI, i'm in no way capable of providing the URL user is redirected to after allowing application to use their data - because command line is off the limits, and this is hardcoded into the library ("Enter the URL you were redirected to: ") A very simple solution would be implementing http server going with localhost:<someport>, where user is redirected to and application is just reading the data off the request directly (just like in [Listing 20-2 on rust cookbook](https://doc.rust-lang.org/book/ch20-01-single-threaded.html)). If this is already implemented/has a possible workaround without rebuilding entire library, please let me know - I'll close the issue immediately.
kerem closed this issue 2026-02-27 20:22:47 +03:00
Author
Owner

@marioortizmanero commented on GitHub (Sep 25, 2020):

This was being discussed at #4. I don't think that implementing a server is something this library should do, that's part of the user's implementation. The examples/webapp example covers this more or less, so you might want to take a look.

<!-- gh-comment-id:698909410 --> @marioortizmanero commented on GitHub (Sep 25, 2020): This was being discussed at #4. I don't think that implementing a server is something this library should do, that's part of the user's implementation. The `examples/webapp` example covers this more or less, so you might want to take a look.
Author
Owner

@hypixus commented on GitHub (Sep 25, 2020):

I understand what you mean, yet having this hardcoded leaves user in need of rebuilding entire library to suit his needs - which is what i tried to avoid at first. Having limited rust knowledge leaves me with little to none understanding of example provided, but seeing its a matter of replacing a few lines and compiling thing on my own it sounds simple enough to do myself. Thanks for your time, closing.

<!-- gh-comment-id:698917470 --> @hypixus commented on GitHub (Sep 25, 2020): I understand what you mean, yet having this hardcoded leaves user in need of rebuilding entire library to suit his needs - which is what i tried to avoid at first. Having limited rust knowledge leaves me with little to none understanding of example provided, but seeing its a matter of replacing a few lines and compiling thing on my own it sounds simple enough to do myself. Thanks for your time, closing.
Author
Owner

@marioortizmanero commented on GitHub (Sep 25, 2020):

What is hardcoded? You can still get access tokens without the stdin method. get_token is just an utility for the CLI apps: https://github.com/ramsayleung/rspotify/blob/v0.9/src/util.rs#L94. This is going to be refactored for the next release but the concept will be the same. I strongly recommend you to learn enough Rust to understand the example I linked you, as it's basically the same thing as what you're talking about.

<!-- gh-comment-id:698936786 --> @marioortizmanero commented on GitHub (Sep 25, 2020): What is hardcoded? You can still get access tokens without the stdin method. `get_token` is just an utility for the CLI apps: https://github.com/ramsayleung/rspotify/blob/v0.9/src/util.rs#L94. This is going to be refactored for the next release but the concept will be the same. I strongly recommend you to learn enough Rust to understand the example I linked you, as it's basically the same thing as what you're talking about.
Author
Owner

@hypixus commented on GitHub (Sep 25, 2020):

get_token is just an utility for the CLI apps

That's what my understanding lacked. Having spent last hour on understanding line by line, I understand now that it can be used without changing library at all. Thanks once more!

<!-- gh-comment-id:698944958 --> @hypixus commented on GitHub (Sep 25, 2020): > get_token is just an utility for the CLI apps That's what my understanding lacked. Having spent last hour on understanding line by line, I understand now that it can be used without changing library at all. Thanks once more!
Author
Owner

@marioortizmanero commented on GitHub (Sep 25, 2020):

I will confess the documentation leaves to be desired. Hopefully the next release will improve that :) If you have any more suggestions do let us know.

<!-- gh-comment-id:698950420 --> @marioortizmanero commented on GitHub (Sep 25, 2020): I will confess the documentation leaves to be desired. Hopefully the next release will improve that :) If you have any more suggestions do let us know.
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#44
No description provided.