mirror of
https://github.com/JuLi0n21/pwa-player.git
synced 2026-04-19 23:40:05 +00:00
add some debugging
This commit is contained in:
@@ -141,6 +141,7 @@ func Oauth(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
if state != cookie {
|
if state != cookie {
|
||||||
|
|
||||||
|
fmt.Println(state, cookie)
|
||||||
http.Error(w, "Forbidden", http.StatusForbidden)
|
http.Error(w, "Forbidden", http.StatusForbidden)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -159,6 +160,7 @@ func Oauth(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
req, err := http.NewRequest("POST", "https://osu.ppy.sh/oauth/token", bytes.NewBufferString(body.Encode()))
|
req, err := http.NewRequest("POST", "https://osu.ppy.sh/oauth/token", bytes.NewBufferString(body.Encode()))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
fmt.Println("Error: ", err.Error())
|
||||||
http.Error(w, "Forbidden", http.StatusForbidden)
|
http.Error(w, "Forbidden", http.StatusForbidden)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -172,18 +174,21 @@ func Oauth(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
res, err := httpclient.Do(req)
|
res, err := httpclient.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
fmt.Println("Error: ", err.Error())
|
||||||
http.Error(w, "Forbidden", http.StatusForbidden)
|
http.Error(w, "Forbidden", http.StatusForbidden)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
defer res.Body.Close()
|
defer res.Body.Close()
|
||||||
|
|
||||||
if res.StatusCode < http.StatusOK || res.StatusCode >= http.StatusBadRequest {
|
if res.StatusCode < http.StatusOK || res.StatusCode >= http.StatusBadRequest {
|
||||||
|
fmt.Println("Error: ", err.Error())
|
||||||
http.Error(w, "Forbidden", http.StatusForbidden)
|
http.Error(w, "Forbidden", http.StatusForbidden)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
data, err := io.ReadAll(res.Body)
|
data, err := io.ReadAll(res.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
fmt.Println("Error: ", err.Error())
|
||||||
http.Error(w, "Forbidden", http.StatusForbidden)
|
http.Error(w, "Forbidden", http.StatusForbidden)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -193,6 +198,7 @@ func Oauth(w http.ResponseWriter, r *http.Request) {
|
|||||||
err = json.Unmarshal(data, &authToken)
|
err = json.Unmarshal(data, &authToken)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
|
fmt.Println("Error: ", err.Error())
|
||||||
http.Error(w, "Forbidden", http.StatusForbidden)
|
http.Error(w, "Forbidden", http.StatusForbidden)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user