File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change 1
1
<!DOCTYPE html>
2
2
< html >
3
-
4
3
< head >
5
4
< title > GrooveGraph - Authentication</ title >
6
5
</ head >
7
-
8
6
< body >
9
7
< script >
10
8
const params = new URLSearchParams ( window . location . search ) ;
11
9
const code = params . get ( 'code' ) ;
12
10
const state = params . get ( 'state' ) ;
13
-
11
+
14
12
if ( code && state === sessionStorage . getItem ( 'spotify_auth_state' ) ) {
15
13
// Store the code and redirect to main app
16
14
sessionStorage . setItem ( 'spotify_auth_code' , code ) ;
21
19
}
22
20
</ script >
23
21
</ body >
24
-
25
22
</ html >
Original file line number Diff line number Diff line change @@ -59,7 +59,8 @@ class SpotifyAuth {
59
59
const response = await fetch ( 'https://accounts.spotify.com/api/token' , {
60
60
method : 'POST' ,
61
61
headers : {
62
- 'Content-Type' : 'application/x-www-form-urlencoded'
62
+ 'Content-Type' : 'application/x-www-form-urlencoded' ,
63
+ 'Authorization' : 'Basic ' + btoa ( `${ this . config . clientId } :${ this . config . clientSecret } ` )
63
64
} ,
64
65
body : new URLSearchParams ( {
65
66
grant_type : 'authorization_code' ,
@@ -75,8 +76,10 @@ class SpotifyAuth {
75
76
sessionStorage . setItem ( 'spotify_access_token' , data . access_token ) ;
76
77
sessionStorage . setItem ( 'spotify_refresh_token' , data . refresh_token ) ;
77
78
78
- window . location . href = '/' ; // Redirect to main page
79
+ // Change this line to redirect to your actual homepage URL
80
+ window . location . href = 'https://itzsudipta.github.io/GrooveGraph/' ;
79
81
} catch ( error ) {
82
+ console . error ( 'Token exchange error:' , error ) ;
80
83
this . handleError ( 'Authentication failed' ) ;
81
84
}
82
85
}
You can’t perform that action at this time.
0 commit comments