Use tokenFromRequest in handleAccountLogout

oauth2
maru 2024-04-25 15:31:53 -04:00
parent 2656c0a033
commit 65e7696e7e
No known key found for this signature in database
GPG Key ID: 37689350E9CD0F0D
1 changed files with 2 additions and 3 deletions

View File

@ -1,7 +1,6 @@
package api
import (
"encoding/base64"
"encoding/json"
"fmt"
"net/http"
@ -89,9 +88,9 @@ func handleAccountLogin(w http.ResponseWriter, r *http.Request) {
}
func handleAccountLogout(w http.ResponseWriter, r *http.Request) {
token, err := base64.StdEncoding.DecodeString(r.Header.Get("Authorization"))
token, err := tokenFromRequest(r)
if err != nil {
httpError(w, r, fmt.Errorf("failed to decode token: %s", err), http.StatusBadRequest)
httpError(w, r, err, http.StatusBadRequest)
return
}