Skip to content

Commit 618bf97

Browse files
Remove error about using API key and org (grafana#136)
This will simplify code in the provider. In some cases, we obtain the OrgID from the API and send it back on every request, regardless of auth
1 parent 6dbd4ad commit 618bf97

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

Diff for: client.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,11 @@ func (c *Client) newRequest(method, requestPath string, query url.Values, body i
160160
return req, err
161161
}
162162

163+
// cannot use both API key and org ID. API keys are scoped to single org
163164
if c.config.APIKey != "" {
164-
if c.config.OrgID != 0 {
165-
return req, fmt.Errorf("cannot use both API key and org ID. API keys are scoped to single org")
166-
}
167165
req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", c.config.APIKey))
168-
} else if c.config.OrgID != 0 {
166+
}
167+
if c.config.OrgID != 0 {
169168
req.Header.Add("X-Grafana-Org-Id", strconv.FormatInt(c.config.OrgID, 10))
170169
}
171170

0 commit comments

Comments
 (0)