Can't Create New Organizations via API

I am trying to create new organizations via the api call:

curl http://admin:admin@localhost:3000/api/orgs -i -X POST -H ‘Content-Type: application/json;charset=UTF-8’ -d ‘{“name”:“deal”}’

The following are my environment variables:

  GF_AUTH_BASIC_ENABLED:       false
  GF_AUTH_ANONYMOUS_ENABLED:   true
  GF_AUTH_ANONYMOUS_ORG_ROLE:  Admin
  GF_SERVER_ROOT_URL:          /grafana-monitoring
  GF_USERS_ALLOW_ORG_CREATE:   true

I keep getting Access Denied:

HTTP/1.1 403 Forbidden
Content-Type: application/json
Set-Cookie: grafana_sess=31e386229ad458ab; Path=/grafana-monitoring; HttpOnly
Date: Tue, 30 Jan 2018 12:09:42 GMT
Content-Length: 27

{“message”:“Access denied”}

Any ideas why this is happening?

Not to worry…

Fixed it by setting GF_AUTH_BASIC_ENABLED: true

1 Like