feat(auth): use ncspot client id for HTTP requests
With the newly added `get_token_with_client_id()` API we can pass the ncspot client ID again to acquire a token for all Web API requests.
This commit is contained in:
@@ -7,6 +7,7 @@ use crate::config::{self, Config};
|
|||||||
use crate::spotify::Spotify;
|
use crate::spotify::Spotify;
|
||||||
|
|
||||||
pub const SPOTIFY_CLIENT_ID: &str = "65b708073fc0480ea92a077233ca87bd";
|
pub const SPOTIFY_CLIENT_ID: &str = "65b708073fc0480ea92a077233ca87bd";
|
||||||
|
pub const NCSPOT_CLIENT_ID: &str = "d420a117a32841c2b3474932e49fb54b";
|
||||||
pub const CLIENT_REDIRECT_URI: &str = "http://127.0.0.1:8989/login";
|
pub const CLIENT_REDIRECT_URI: &str = "http://127.0.0.1:8989/login";
|
||||||
|
|
||||||
static OAUTH_SCOPES: &[&str] = &[
|
static OAUTH_SCOPES: &[&str] = &[
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
use crate::authentication;
|
||||||
use crate::events::{Event, EventManager};
|
use crate::events::{Event, EventManager};
|
||||||
use crate::model::playable::Playable;
|
use crate::model::playable::Playable;
|
||||||
use crate::queue::QueueEvent;
|
use crate::queue::QueueEvent;
|
||||||
@@ -74,7 +75,7 @@ impl Worker {
|
|||||||
let scopes = "user-read-private,playlist-read-private,playlist-read-collaborative,playlist-modify-public,playlist-modify-private,user-follow-modify,user-follow-read,user-library-read,user-library-modify,user-top-read,user-read-recently-played";
|
let scopes = "user-read-private,playlist-read-private,playlist-read-collaborative,playlist-modify-public,playlist-modify-private,user-follow-modify,user-follow-read,user-library-read,user-library-modify,user-top-read,user-read-recently-played";
|
||||||
session
|
session
|
||||||
.token_provider()
|
.token_provider()
|
||||||
.get_token(scopes)
|
.get_token_with_client_id(scopes, authentication::NCSPOT_CLIENT_ID)
|
||||||
.map(|response| sender.send(response.ok()).expect("token channel is closed"))
|
.map(|response| sender.send(response.ok()).expect("token channel is closed"))
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user