From 6781b343ad5dc9087374af103a0a0155ad079b79 Mon Sep 17 00:00:00 2001 From: Acha Bill <57879913+acha-bill@users.noreply.github.com> Date: Fri, 26 Apr 2024 10:09:43 +0100 Subject: [PATCH] fix: missing auth (#396) --- pkg/bee/debugapi/debugapi.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/bee/debugapi/debugapi.go b/pkg/bee/debugapi/debugapi.go index 5ee259897..d2ff7e9f4 100644 --- a/pkg/bee/debugapi/debugapi.go +++ b/pkg/bee/debugapi/debugapi.go @@ -117,6 +117,14 @@ func (c *Client) requestWithHeader(ctx context.Context, method, path string, hea req.Header = header req.Header.Add("Accept", contentType) + if c.restricted && req.Header.Get("Authorization") == "" { + key, err := api.GetToken(path, method) + if err != nil { + return err + } + req.Header.Set("Authorization", "Bearer "+key) + } + r, err := c.httpClient.Do(req) if err != nil { return err