u
Anirudh Oppiliappan x@icyphox.sh
Tue, 26 Sep 2023 23:32:24 +0300
1 files changed,
5 insertions(+),
7 deletions(-)
jump to
M
masto.go
→
masto.go
@@ -1,6 +1,7 @@
package main import ( + "database/sql" "fmt" "net/http"@@ -56,14 +57,11 @@ }
// https://docs.joinmastodon.org/methods/oauth/#authorize func oauthorize(rw http.ResponseWriter, r *http.Request) { - clientID := r.Form.Get("client_id") - redirectURI := r.Form.Get("redirect_uri") + clientID := r.FormValue("client_id") + redirectURI := r.FormValue("redirect_uri") - fmt.Println("redirectURI", redirectURI) - fmt.Println("clientID", clientID) - - _, err := stmtCheckClientId.Exec(clientID) - if err != nil { + err := stmtCheckClientId.QueryRow(clientID).Scan() + if err == sql.ErrNoRows { elog.Println("oauth: no such client:", clientID) rw.WriteHeader(http.StatusUnauthorized) return