mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
API Docs: create Authentication page and order sidebar menu (#92900)
* API Docs: create `Authentication` page and order sidebar menu * fix minor typos * Update capitalization We don't capitalize titles as per https://grafana.com/docs/writers-toolkit/write/style-guide/capitalization-punctuation/ * Update docs/sources/developers/http_api/examples/_index.md Co-authored-by: Jack Baldry <jack.baldry@grafana.com> * Update docs/sources/developers/http_api/authentication.md Co-authored-by: Jack Baldry <jack.baldry@grafana.com> --------- Co-authored-by: Irene Rodriguez <irene.rodriguez@grafana.com> Co-authored-by: Jack Baldry <jack.baldry@grafana.com>
This commit is contained in:
@@ -27,40 +27,11 @@ Since version 8.4, HTTP API details are [specified](https://editor.swagger.io/?u
|
||||
|
||||
Starting from version 9.1, there is also a [OpenAPI v3 specification](https://editor.swagger.io/?url=https://raw.githubusercontent.com/grafana/grafana/main/public/openapi3.json) (generated by the v2 one).
|
||||
|
||||
Users can browser and try out both via the Swagger UI editor (served by the grafana server) by navigating to `/swagger-ui`.
|
||||
Users can browser and try out both via the Swagger UI editor (served by the Grafana server) by navigating to `/swagger-ui`.
|
||||
|
||||
## Authenticating API requests
|
||||
## Authenticate API requests
|
||||
|
||||
You can authenticate requests using basic auth, a service account token or a session cookie (acquired using regular login or OAuth).
|
||||
|
||||
### Basic Auth
|
||||
|
||||
If basic auth is enabled (it is enabled by default), then you can authenticate your HTTP request via
|
||||
standard basic auth. Basic auth will also authenticate LDAP users.
|
||||
|
||||
curl example:
|
||||
|
||||
```bash
|
||||
curl http://admin:admin@localhost:3000/api/org
|
||||
{"id":1,"name":"Main Org."}
|
||||
```
|
||||
|
||||
### Service Account Token
|
||||
|
||||
To create a service account token, click on **Administration** in the left-side menu, click **Users and access**, then **Service Accounts**.
|
||||
For more information on how to use service account tokens, refer to the [Service Accounts]({{< relref "../../administration/service-accounts/" >}}) documentation.
|
||||
|
||||
You use the token in all requests in the `Authorization` header, like this:
|
||||
|
||||
**Example**:
|
||||
|
||||
```http
|
||||
GET http://your.grafana.com/api/dashboards/db/mydash HTTP/1.1
|
||||
Accept: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
```
|
||||
|
||||
The `Authorization` header value should be `Bearer <your service account token>`.
|
||||
{{< docs/shared lookup="developers/authentication.md" source="grafana" version="<GRAFANA_VERSION>" >}}
|
||||
|
||||
## X-Grafana-Org-Id Header
|
||||
|
||||
@@ -110,7 +81,7 @@ Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
|
||||
## Grafana Enterprise HTTP APIs
|
||||
|
||||
Grafana Enterprise includes all of the Grafana OSS APIs as well as those that follow:
|
||||
Grafana Enterprise includes all of the Grafana OSS APIs as well as the following APIs:
|
||||
|
||||
- [Data source permissions API]({{< relref "datasource_permissions/" >}})
|
||||
- [License API]({{< relref "licensing/" >}})
|
||||
|
||||
Reference in New Issue
Block a user