diff --git a/content/shared/v3-core-get-started/_index.md b/content/shared/v3-core-get-started/_index.md index f6f3bfa69..f4e160ab4 100644 --- a/content/shared/v3-core-get-started/_index.md +++ b/content/shared/v3-core-get-started/_index.md @@ -252,14 +252,34 @@ To have the `influxdb3` CLI use your admin token automatically, assign it to the To create an admin token, use the `influxdb3 create token --admin` subcommand--for example: +{{< code-tabs-wrapper >}} + +{{% code-tabs %}} +[CLI](#) +[Docker](#) +{{% /code-tabs %}} +{{% code-tab-content %}} + ```bash influxdb3 create token --admin \ - --host http://{{< influxdb/host >}} + --host http://INFLUXDB_HOST ``` + +{{% /code-tab-content %}} +{{% code-tab-content %}} + +{{% code-placeholders "CONTAINER_NAME" %}} ```bash -# With Docker -- In a new terminal, run: +# With Docker — in a new terminal: docker exec -it CONTAINER_NAME influxdb3 create token --admin ``` +{{% /code-placeholders %}} + +Replace {{% code-placeholder-key %}}`CONTAINER_NAME`{{% /code-placeholder-key %}} with the name of your running Docker container. + +{{% /code-tab-content %}} + +{{< /code-tabs-wrapper >}} The command returns a token string that you can use to authenticate CLI commands and API requests. diff --git a/content/shared/v3-enterprise-get-started/_index.md b/content/shared/v3-enterprise-get-started/_index.md index 50116db52..7262570f5 100644 --- a/content/shared/v3-enterprise-get-started/_index.md +++ b/content/shared/v3-enterprise-get-started/_index.md @@ -282,14 +282,34 @@ To have the `influxdb3` CLI use your admin token automatically, assign it to the To create an admin token, use the `influxdb3 create token --admin` subcommand--for example: +{{< code-tabs-wrapper >}} + +{{% code-tabs %}} +[CLI](#) +[Docker](#) +{{% /code-tabs %}} +{{% code-tab-content %}} + ```bash influxdb3 create token --admin \ - --host http://{{< influxdb/host >}} + --host http://INFLUXDB_HOST ``` + +{{% /code-tab-content %}} +{{% code-tab-content %}} + +{{% code-placeholders "CONTAINER_NAME" %}} ```bash -# With Docker -- In a new terminal, run: +# With Docker — in a new terminal: docker exec -it CONTAINER_NAME influxdb3 create token --admin ``` +{{% /code-placeholders %}} + +Replace {{% code-placeholder-key %}}`CONTAINER_NAME`{{% /code-placeholder-key %}} with the name of your running Docker container. + +{{% /code-tab-content %}} + +{{< /code-tabs-wrapper >}} The command returns a token string that you can use to authenticate CLI commands and API requests. @@ -316,6 +336,7 @@ To create a database token, use the `influxdb3 create token` subcommand and pass The following example shows how to create a database token that expires in 90 days and has read and write permissions for all databases on the server: {{% code-placeholders "ADMIN_TOKEN" %}} + ```bash influxdb3 create token \ --permission \ @@ -327,8 +348,7 @@ influxdb3 create token \ ``` {{% /code-placeholders %}} -In your command, replace {{% code-placeholder-key %}} `ADMIN_TOKEN`{{% /code-placeholder-key %}} -with the admin token you created earlier. +In your command, replace {{% code-placeholder-key %}} `ADMIN_TOKEN`{{% /code-placeholder-key %}} with the admin token you created earlier. #### Create a system token @@ -355,6 +375,8 @@ To create a system token, use the `influxdb3 create token` subcommand and pass t The following example shows how to create a system token that expires in 1 year and has read permissions for all system endpoints on the server: +{{% code-placeholders "ADMIN_TOKEN" %}} + ```bash influxdb3 create token \ --permission \ @@ -364,6 +386,9 @@ influxdb3 create token \ --name "all system endpoints" \ "system:*:read" ``` +{{% /code-placeholders %}} + +In your command, replace {{% code-placeholder-key %}} `ADMIN_TOKEN`{{% /code-placeholder-key %}} with the admin token you created earlier. For more information, see how to [Manage resource tokens](/influxdb3/version/admin/tokens/resource/). @@ -372,14 +397,18 @@ For more information, see how to [Manage resource tokens](/influxdb3/version/adm - To authenticate `influxdb3` CLI commands, use the `--token` option or assign your token to the `INFLUXDB3_AUTH_TOKEN` environment variable for `influxdb3` to use it automatically. - To authenticate HTTP API requests, include `Bearer ` in the `Authorization` header value--for example: - + +{{% code-placeholders "SYSTEM_TOKEN" %}} + ```bash curl "http://{{< influxdb/host >}}/health" \ --header "Authorization: Bearer SYSTEM_TOKEN" ``` +{{% /code-placeholders %}} - In your request, replace - {{% code-placeholder-key %}}`SYSTEM_TOKEN`{{% /code-placeholder-key %}} with the system token you created earlier. +Replace the following: + +In your command, replace {{% code-placeholder-key %}}`SYSTEM_TOKEN`{{% /code-placeholder-key %}}: System token that grants access to system endpoints (`/health`, `/metrics`, etc.) ### Data model