Open JulietteDestang opened 1 year ago
hi guys, thanks for this package!
i'm trying to create an oAuth for spotify, but i have an "infinite loop" in the callback
func AuthSpotify(w http.ResponseWriter, r *http.Request) { tok, err := auth.Token(r.Context(), state, r) if err != nil { http.Error(w, "Couldn't get token", http.StatusForbidden) log.Fatal(err) } if st := r.FormValue("state"); st != state { http.NotFound(w, r) log.Fatalf("State mismatch: %s != %s\n", st, state) } client := spotify.New(auth.Client(r.Context(), tok)) // infinite loop ^^^ w.Header().Set("Content-Type", "text/html") fmt.Fprintf(w, "Login Completed!") ch <- client }
i send the url to my front with this function:
func GetSpotifyUrl(w http.ResponseWriter, r *http.Request) { fmt.Println("ok") url := auth.AuthURL(state) res, _ := json.Marshal(url) w.WriteHeader(http.StatusOK) w.Write(res) }
the redirect is working and call my callback, but i'm stuck in this callback function :/
can you help me? thanks a lot!
hi guys, thanks for this package!
i'm trying to create an oAuth for spotify, but i have an "infinite loop" in the callback
i send the url to my front with this function:
the redirect is working and call my callback, but i'm stuck in this callback function :/
can you help me? thanks a lot!