fixed server-side login flow.

This commit is contained in:
2025-02-02 19:56:52 +00:00
parent 307dafdb9d
commit afc0c18594
3 changed files with 8 additions and 8 deletions
BIN
View File
Binary file not shown.
+4 -4
View File
@@ -17,15 +17,15 @@ func generateRandomString(length int) string {
}
func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
err := godotenv.Load("../music/.env")
if err != nil {
log.Fatalf("Error loading .env file: %s", err)
}
client_id := os.Getenv("SPOTIFY_CLIENT_ID")
redirect_uri := "cs2440.joshashton.dev/music"
http.HandleFunc("/spotify-login", func(w http.ResponseWriter, r *http.Request) {
redirect_uri := "https://cs2440.joshashton.dev/music"
scope := "user-top-read"
redirectURL := "https://accounts.spotify.com/authorize?" + strings.Join([]string{
+1 -1
View File
@@ -2,7 +2,7 @@
session_start();
if (!isset($_GET['code'])) {
header('Location: https://api.joshashton.dev/spotify-login');
header('Location: https://login.joshashton.dev/');
exit;
}
?>