fixed server-side login flow.
This commit is contained in:
+4
-4
@@ -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
@@ -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;
|
||||
}
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user