Skip to content

Commit f7a538d

Browse files
committed
chore(v2): Explain v1-compatible auth and add a troubleshooting section with a negative example. Putting a bow on #4393. Verified that Kapa.ai knows how to authenticate to v1 endpoints in each version
1 parent e94257a commit f7a538d

File tree

2 files changed

+48
-6
lines changed

2 files changed

+48
-6
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ 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 {{< current-version >}} API with InfluxDB 1.x clients
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

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

0 commit comments

Comments
 (0)