From 2eaa30305b7207650ca79764ea1547ba20d1a861 Mon Sep 17 00:00:00 2001 From: Pal Kerecsenyi Date: Sat, 21 Oct 2023 12:46:25 +0100 Subject: [PATCH] Add client authentication --- client.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client.go b/client.go index 53814ba..bb97ae1 100644 --- a/client.go +++ b/client.go @@ -39,10 +39,12 @@ func mapToQuery(variables map[string]string) (output string) { } func (c *PalAuthIAMClient) buildURL(path string, query map[string]string) string { - return fmt.Sprintf("%s%s?%s", c.baseURL, path, mapToQuery(query)) + return fmt.Sprintf("%s/%s%s?%s", c.baseURL, c.clientId, path, mapToQuery(query)) } func (c *PalAuthIAMClient) runRequest(req *http.Request, mapTo interface{}) error { + req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", c.clientSecret)) + res, err := http.DefaultClient.Do(req) if err != nil { return fmt.Errorf("making request: %s", err)