mirror of
https://github.com/muety/wakapi.git
synced 2023-08-10 21:12:56 +03:00
chore: accept bearer prefix in auth header
This commit is contained in:
parent
22fbfceca2
commit
59b85863cc
@ -36,7 +36,7 @@ func ExtractBasicAuth(r *http.Request) (username, password string, err error) {
|
||||
|
||||
func ExtractBearerAuth(r *http.Request) (key string, err error) {
|
||||
authHeader := strings.Split(r.Header.Get("Authorization"), " ")
|
||||
if len(authHeader) != 2 || authHeader[0] != "Basic" {
|
||||
if len(authHeader) != 2 || (authHeader[0] != "Basic" && authHeader[0] != "Bearer") {
|
||||
return key, errors.New("failed to extract API key")
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user