Giter VIP home page Giter VIP logo

spotify-rs's People

Contributors

bogpan avatar domanteli0 avatar sloganking avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

spotify-rs's Issues

Provide Examples

Provide examples in an Examples/ directory. That show how to use this lib.

Can't generate valid "auth_code" and "csrf_token"

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]
async fn main() -> Result<(), Box<dyn Error>> {
    // This should match the redirect URI you set in your app's settings
    let 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 token
    let (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

    let mut spotify = client
        .authenticate("auth_code", "csrf_token")
        .await
        .unwrap();

function. But as a result I get

`Err` value: InvalidStateParameter

Is this an error in this lib or am I doing something wrong?

Functional Pagination

Hi, I'm currently using your API bindings to implement a project and am very happy for your work.

One thing that bothers me though: when querying things that require pagination, you return the beautiful Page<> struct, but you don't offer any methods for conveniently fetching the next/previous page (or at least I couldn't figure out how). This means an index calculation based of the information in the response is required, followed by a whole more run through the builder setup.

I would like to offer my help in implementing this functionality if you are interested :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.