diff --git a/auth/routes.go b/auth/routes.go index 23ec083..cb1131e 100644 --- a/auth/routes.go +++ b/auth/routes.go @@ -49,9 +49,9 @@ func Callback(app *core.App) func(w http.ResponseWriter, r *http.Request) { // use the same state string here that you used to generate the URL token, err := app.SpotifyAuth.Token(r.Context(), state.(string), r) - if err != nil { + if err != nil || token == nil { fmt.Println(err) - http.Error(w, "Couldn't get token", http.StatusNotFound) + http.Error(w, "Couldn't get token", http.StatusInternalServerError) return } @@ -61,7 +61,7 @@ func Callback(app *core.App) func(w http.ResponseWriter, r *http.Request) { if err != nil { fmt.Println(err) - http.Error(w, "Couldn't get current user", http.StatusNotFound) + http.Error(w, "Couldn't get current user", http.StatusInternalServerError) return } @@ -69,7 +69,7 @@ func Callback(app *core.App) func(w http.ResponseWriter, r *http.Request) { if err != nil { fmt.Println(err) - http.Error(w, "Couldn't save token", http.StatusNotFound) + http.Error(w, "Couldn't save token", http.StatusInternalServerError) return }