File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed
Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,11 @@ client_id = "xxxxx"
1111client_secret = " xxxxx"
1212auth_url = " https://accounts.spotify.com/authorize"
1313token_url = " https://accounts.spotify.com/api/token"
14+ scopes = [
15+ " user-library-read" ,
16+ " playlist-modify-public" ,
17+ " playlist-modify-private"
18+ ]
1419
1520[web ]
1621address = " 127.0.0.1:8080"
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ use crate::{
33 web:: ui:: { error_page, not_found} ,
44} ;
55use actix_web:: { dev:: HttpServiceFactory , web} ;
6- use oauth2:: { CsrfToken , TokenResponse } ;
6+ use oauth2:: { CsrfToken , Scope , TokenResponse } ;
77use reqwest:: Url ;
88use serde:: Deserialize ;
99use yew:: { ServerRenderer , html} ;
@@ -163,6 +163,8 @@ pub struct OAuth2Config {
163163 pub client_secret : String ,
164164 pub auth_url : String ,
165165 pub token_url : String ,
166+ #[ serde( default ) ]
167+ pub scopes : Vec < String > ,
166168}
167169
168170impl OAuth2Config {
@@ -183,6 +185,7 @@ impl OAuth2Config {
183185
184186 let ( url, _csrf) = client
185187 . authorize_url ( || CsrfToken :: new_random ( ) )
188+ . add_scopes ( self . scopes . iter ( ) . cloned ( ) . map ( Scope :: new) )
186189 . url ( )
187190 . clone ( ) ;
188191 Ok ( url)
You can’t perform that action at this time.
0 commit comments