Skip to content

Commit c035989

Browse files
authored
Merge pull request #6188 from influxdata/jstirnaman/issue4393
Clarify authorization for v1-compatibility endpoints in v2
2 parents 00e4b4a + 8e95019 commit c035989

File tree

5 files changed

+54
-12
lines changed

5 files changed

+54
-12
lines changed

content/shared/influxdb-v2/api-guide/api_intro.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ This section guides you through the most commonly used API methods.
55

66
For detailed documentation on the entire API, see the [InfluxDB v2 API Reference](/influxdb/version/reference/api/#influxdb-v2-api-documentation).
77

8-
{{% note %}}
9-
If you need to use InfluxDB {{< current-version >}} with **InfluxDB 1.x** API clients and integrations, see the [1.x compatibility API](/influxdb/version/reference/api/#influxdb-v1-compatibility-api-reference-documentation).
10-
{{% /note %}}
8+
> [!Tip]
9+
> #### Use InfluxDB 1.x API clients with {{< current-version >}}
10+
> If you need to use InfluxDB {{< current-version >}} with **InfluxDB 1.x** API clients and integrations, see the [1.x compatibility guide](/influxdb/version/reference/api/influxdb-1x/).
1111
1212
## Bootstrap your application
1313

1414
With most API requests, you'll need to provide a minimum of your InfluxDB URL and Authorization Token (API Token).
1515

16-
[Install InfluxDB OSS v2.x](/influxdb/version/install/) or upgrade to
16+
[Install InfluxDB OSS v2.x](/influxdb/v2/install/) or upgrade to
1717
an [InfluxDB Cloud account](/influxdb/cloud/sign-up).
1818

1919
### Authentication

content/shared/influxdb-v2/api-guide/influxdb-1x/_index.md

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,13 @@ InfluxDB 1.x compatibility endpoints require all query and write requests to be
1010
[API token](/influxdb/version/admin/tokens/) or 1.x-compatible
1111
credentials.
1212

13-
* [Authenticate with the Token scheme](#authenticate-with-the-token-scheme)
14-
* [Authenticate with a 1.x username and password scheme](#authenticate-with-a-username-and-password-scheme)
13+
> [!Important]
14+
> #### Authenticate with an API token or 1.x-compatible credentials
15+
> You can't use an InfluxDB 2.x username and password to authenticate with the InfluxDB 1.x compatibility API.
16+
17+
- [Authenticate with the Token scheme](#authenticate-with-the-token-scheme)
18+
- [Authenticate with a 1.x username and password scheme](#authenticate-with-a-username-and-password-scheme)
19+
- [Troubleshoot authentication issues](#troubleshoot-authentication-issues)
1520

1621
### Authenticate with the Token scheme
1722
Token authentication requires the following credential:
@@ -259,7 +264,44 @@ Replace the following:
259264

260265
{{% /show-in %}}
261266

262-
##### InfluxQL support
267+
### Troubleshoot authentication issues
268+
269+
#### Unauthorized when using the initial username and password
270+
271+
You can't use the InfluxDB 2.x username and password to authenticate with the InfluxDB 1.x compatibility API.
272+
For example, given the following Docker Compose configuration:
273+
274+
```yaml
275+
# Docker compose example
276+
influx2:
277+
image: influxdb:2.4.0
278+
volumes:
279+
- ./dev/influxdb2:/var/lib/influxdb2
280+
ports:
281+
- "8086:8086"
282+
environment:
283+
DOCKER_INFLUXDB_INIT_USERNAME: dev
284+
DOCKER_INFLUXDB_INIT_PASSWORD: 12345678
285+
DOCKER_INFLUXDB_INIT_ORG: com.some
286+
DOCKER_INFLUXDB_INIT_BUCKET: m2_dev
287+
DOCKER_INFLUXDB_INIT_MODE: setup
288+
```
289+
290+
The following query using the v1 `/query` endpoint and v2 initial username and password returns an `unauthorized` error:
291+
292+
```bash
293+
# Using the initial username and password
294+
curl --get "http://localhost:8086/query" \
295+
--data-urlencode "u=dev" \
296+
--data-urlencode "p=12345678" \
297+
--data-urlencode "db=m2_dev" \
298+
--data-urlencode "q=SELECT * FROM default"
299+
```
300+
301+
Instead, [authenticate with a token](#authenticate-with-the-token-scheme) or a [1.x username and password scheme](#authenticate-with-a-username-and-password-scheme).
302+
303+
304+
## InfluxQL support
263305

264306
The compatibility API supports InfluxQL, with the following caveats:
265307

content/shared/influxdb-v2/monitor-alert/templates/monitor.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Do the following:
1717
Before you begin, make sure you have access to the following:
1818

1919
- InfluxDB Cloud account ([sign up for free here](https://cloud2.influxdata.com/signup))
20-
- Command line access to a machine [running InfluxDB OSS 2.x](/influxdb/version/install/) and permissions to install Telegraf on this machine
20+
- Command line access to a machine [running InfluxDB OSS 2.x](/influxdb/v2/install/) and permissions to install Telegraf on this machine
2121
- Internet connectivity from the machine running InfluxDB OSS 2.x and Telegraf to InfluxDB Cloud
2222
- Sufficient resource availability to install the template (InfluxDB Cloud Free
2323
Plan accounts include [resource limits](/influxdb/cloud/account-management/pricing-plans/#resource-limits/influxdb/cloud/account-management/pricing-plans/#resource-limits))
@@ -53,9 +53,9 @@ InfluxDB OSS metrics to an InfluxDB endpoint and a dashboard that visualizes the
5353
By default, InfluxDB OSS 2.x has a `/metrics` endpoint available, which exports
5454
internal InfluxDB metrics in [Prometheus format](https://prometheus.io/docs/concepts/data_model/).
5555
56-
1. Ensure the `/metrics` endpoint is [enabled](/influxdb/version/reference/config-options/#metrics-disabled).
56+
1. Ensure the `/metrics` endpoint is [enabled](/influxdb/v2/reference/config-options/#metrics-disabled).
5757
If you've changed the default settings to disable the `/metrics` endpoint,
58-
[re-enable these settings](/influxdb/version/reference/config-options/#metrics-disabled).
58+
[re-enable these settings](/influxdb/v2/reference/config-options/#metrics-disabled).
5959
2. Navigate to the `/metrics` endpoint of your InfluxDB OSS instance to view the InfluxDB OSS system metrics in your browser:
6060
6161
## Set up Telegraf

content/shared/influxdb-v2/write-data/migrate-data/migrate-cloud-to-oss.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ each batch to an InfluxDB OSS bucket.
2222

2323
## Set up the migration
2424

25-
1. [Install and set up InfluxDB OSS](/influxdb/version/install/).
25+
1. [Install and set up InfluxDB OSS](/influxdb/v2/install/).
2626

2727
2. **In InfluxDB Cloud**, [create an API token](/influxdb/cloud/admin/tokens/create-token/)
2828
with **read access** to the bucket you want to migrate.

content/shared/influxdb-v2/write-data/replication/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
Running [InfluxDB OSS](/influxdb/version/install/) at the edge lets you collect, process, transform, and analyze high-precision data locally.
2+
Running [InfluxDB OSS](/influxdb/v2/install/) at the edge lets you collect, process, transform, and analyze high-precision data locally.
33
**Edge Data Replication** lets you replicate data from distributed edge environments to [InfluxDB Cloud](/influxdb/cloud/sign-up/), aggregating and storing data for long-term management and analysis.
44

55
{{< youtube qsj_TTpDyf4 >}}

0 commit comments

Comments
 (0)