File tree Expand file tree Collapse file tree 1 file changed +4
-8
lines changed Expand file tree Collapse file tree 1 file changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -4,9 +4,11 @@ use twitch_oauth2::TwitchToken;
4
4
async fn main ( ) -> anyhow:: Result < ( ) > {
5
5
let _ = dotenv:: dotenv ( ) ; // Eat error
6
6
let mut args = std:: env:: args ( ) . skip ( 1 ) ;
7
+
7
8
let reqwest = reqwest:: Client :: builder ( )
8
9
. redirect ( reqwest:: redirect:: Policy :: none ( ) )
9
10
. build ( ) ?;
11
+
10
12
let client_id = std:: env:: var ( "TWITCH_CLIENT_ID" )
11
13
. ok ( )
12
14
. or_else ( || args. next ( ) )
@@ -19,18 +21,12 @@ async fn main() -> anyhow::Result<()> {
19
21
. map ( twitch_oauth2:: ClientSecret :: new)
20
22
. expect ( "Please set env: TWITCH_CLIENT_SECRET or pass client secret as an argument" ) ;
21
23
22
- let scopes = std:: env:: var ( "CLIENT_SCOPES" )
23
- . ok ( )
24
- . map ( |s| s. split ( ' ' ) . map ( |s| s. to_string ( ) ) . collect :: < Vec < _ > > ( ) )
25
- . or_else ( || Some ( args. collect :: < Vec < _ > > ( ) ) )
26
- . map ( |v| v. into_iter ( ) . map ( twitch_oauth2:: Scope :: from) . collect ( ) )
27
- . expect ( "Please set env: CLIENT_SCOPES or pass client secret as an argument" ) ;
28
-
24
+ // Get the app access token
29
25
let token = twitch_oauth2:: AppAccessToken :: get_app_access_token (
30
26
& reqwest,
31
27
client_id,
32
28
client_secret,
33
- scopes ,
29
+ vec ! [ ] ,
34
30
)
35
31
. await ?;
36
32
You can’t perform that action at this time.
0 commit comments