diff --git a/auth/middleware.go b/auth/middleware.go index 63a477ef6846331ce169dfa32bd9c1129c34e270..a82888a67ea48279a40fe8b37e777197180ebba5 100644 --- a/auth/middleware.go +++ b/auth/middleware.go @@ -83,7 +83,11 @@ } func authError(w http.ResponseWriter, reason string, code int) { gqlerr := gqlerror.Errorf("Authentication error: %s", reason) - b, err := json.Marshal(gqlerr) + b, err := json.Marshal(struct { + Errors []*gqlerror.Error `json:"errors"` + } { + Errors: []*gqlerror.Error{gqlerr}, + }) if err != nil { panic(err) } @@ -708,7 +712,7 @@ } auth := r.Header.Get("Authorization") if auth == "" { - authError(w, `Authorization header is required. Expected 'Authorization: Bearer '`, http.StatusUnauthorized) + authError(w, `Authorization header is required. Expected 'Authorization: Bearer [token]'`, http.StatusUnauthorized) return }