aboutsummaryrefslogtreecommitdiffstats
path: root/dashboard/dashapi/dashapi.go
diff options
context:
space:
mode:
authorGreg Steuck <gnezdo@google.com>2021-07-28 15:34:03 -0700
committerDmitry Vyukov <dvyukov@google.com>2021-07-30 18:21:17 +0200
commit6c236867ce33c0c16b102e02a08226d7eb9b2046 (patch)
treebe81602e5bbe634e223bdc2bfc97049dd7f8a57e /dashboard/dashapi/dashapi.go
parent75047cf943db20755af0bf9ce3af5502b4040b70 (diff)
syz-manager: support oauth when calling syz-hub
Permit empty hub_key to indicate oauth.
Diffstat (limited to 'dashboard/dashapi/dashapi.go')
-rw-r--r--dashboard/dashapi/dashapi.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/dashboard/dashapi/dashapi.go b/dashboard/dashapi/dashapi.go
index 14fa44faa..a78e25073 100644
--- a/dashboard/dashapi/dashapi.go
+++ b/dashboard/dashapi/dashapi.go
@@ -53,12 +53,12 @@ func NewCustom(client, addr, key string, ctor RequestCtor, doer RequestDoer,
return nil, err
}
wrappedDoer = func(req *http.Request) (*http.Response, error) {
- if token, err := tokenCache.Get(time.Now()); err == nil {
- req.Header.Add("Authorization", "Bearer "+token)
- return doer(req)
- } else {
+ token, err := tokenCache.Get(time.Now())
+ if err != nil {
return nil, err
}
+ req.Header.Add("Authorization", token)
+ return doer(req)
}
}
return &Dashboard{