Authentication error: invalid scope requested - Raw HTTP req to loki

Trying to send a raw http request to loki, and getthing this error “authentication error: invalid scope requested”

This is how I’m forming my request

content: some json
headers: { ['Content-Type'] = 'application/json', ["X-Scope-OrgID"] = "my_org_id_in_org_settings"})

Any idea whats going on?

Please remove X-Scope-OrgID header.

Already tried removing it, same issue unfortunately

Please provide reproducible example?

Have reproduced it with curl, using a similar example I found here: prometheus - Send logs directly to Loki without use of agents - Stack Overflow

curl -v -H "Content-Type: application/json" -XPOST -s "" --data-raw '{"streams": [{ "stream": { "foo": "bar2" }, "values": [ [ "1570818238000000000", "fizzbuzz" ] ] }]}'


curl \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer username:token" \
  -X POST \
  -d '{"streams": [{ "stream": { "foo": "bar2" }, "values": [ [ "1570818238000000000", "fizzbuzz" ] ] }]}' \

Make sure that you have write permission for used user/token.

Getting the same issue with that curl request you provided

Just to confirm I am getting the username and token from

There’s just a button generate the token, how do I check it has the correct write permission?

Generate new token and select right scope:

Thank you :slight_smile:

My token only had logs read, needed logs write!