Skip to content

Fix v1 auth monolith documentation and tooling #6194

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api-docs/influxdb/cloud/v2/ref.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13731,7 +13731,7 @@ components:
Default is [`RFC3339` date/time format](/influxdb/cloud/reference/glossary/#rfc3339-timestamp).
To include nanoseconds in timestamps, use `RFC3339Nano`.

#### Example formatted date/time values
### Example formatted date/time values

| Format | Value |
|:------------|:----------------------------|
Expand Down
10 changes: 5 additions & 5 deletions api-docs/influxdb/v2/v2/ref.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13270,7 +13270,7 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/LineProtocolError'
description: Line protocol poorly formed and no points were written. Response can be used to determine the first malformed line in the body line-protocol. All data in body was rejected and not written.
description: Line protocol is poorly formed and no points were written. Response can be used to determine the first malformed line in the body line-protocol.
'401':
content:
application/json:
Expand All @@ -13282,7 +13282,7 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error'
description: No token was sent and they are required.
description: The request didn't provide an authorization token.
'413':
content:
application/json:
Expand All @@ -13293,8 +13293,8 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
description: The request was well-formed, but some or all the points were rejected due to semantic errors--for example, schema conflicts or retention policy violations. Error message contains details for one or more rejected points.
$ref: '#/components/schemas/Error'
description: The request was well-formed, but some points were rejected due to semantic errors--for example, schema conflicts or retention policy violations. Error message contains details for one or more rejected points.
'429':
description: Token is temporarily over quota. The Retry-After header describes when to try the write again.
headers:
Expand Down Expand Up @@ -14857,7 +14857,7 @@ components:
Default is [`RFC3339` date/time format](/influxdb/v2/reference/glossary/#rfc3339-timestamp).
To include nanoseconds in timestamps, use `RFC3339Nano`.

#### Example formatted date/time values
### Example formatted date/time values

| Format | Value |
|:------------|:----------------------------|
Expand Down
126 changes: 59 additions & 67 deletions api-docs/influxdb3/cloud-dedicated/v2/ref.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,14 @@ tags:
name: API compatibility
x-traitTag: true
- description: |
Use one of the following schemes to authenticate to the InfluxDB API:

- [Bearer authentication](#section/Authentication/BearerAuthentication)
- [Token authentication](#section/Authentication/TokenAuthentication)
- [Basic authentication](#section/Authentication/BasicAuthentication)
- [Querystring authentication](#section/Authentication/QuerystringAuthentication)
Depending on your workflow, use one of the following schemes to authenticate to the InfluxDB 3 API:

| Authentication scheme | Works with |
|:-------------------|:-----------|
| [Bearer authentication](#section/Authentication/BearerAuthentication) | All endpoints |
| [Token authentication](#section/Authentication/TokenAuthentication) | v1, v2 endpoints |
| [Basic authentication](#section/Authentication/BasicAuthentication) | v1 endpoints |
| [Querystring authentication](#section/Authentication/QuerystringAuthentication) | v1 endpoints |
<!-- ReDoc-Inject: <security-definitions> -->
name: Authentication
x-traitTag: true
Expand Down Expand Up @@ -1097,7 +1099,7 @@ components:
Default is [`RFC3339` date/time format](/influxdb3/cloud-dedicated/reference/glossary/#rfc3339-timestamp).
To include nanoseconds in timestamps, use `RFC3339Nano`.

#### Example formatted date/time values
### Example formatted date/time values

| Format | Value |
|:------------|:----------------------------|
Expand Down Expand Up @@ -1978,61 +1980,45 @@ components:
type: string
securitySchemes:
BasicAuthentication:
type: http
scheme: basic
description: |
### Basic authentication scheme

Use the `Authorization` header with the `Basic` scheme to authenticate v1 API `/write` and `/query` requests.
When authenticating requests, InfluxDB 3 Cloud Dedicated checks that the `password` part of the decoded credential is an authorized [database token](/influxdb3/cloud-dedicated/admin/tokens/).
InfluxDB 3 Cloud Dedicated ignores the `username` part of the decoded credential.

### Syntax
Use the `Authorization` header with the `Basic` scheme to authenticate v1 API requests.

```http
Authorization: Basic <base64-encoded [USERNAME]:DATABASE_TOKEN>
```

Replace the following:
Works with v1 compatibility [`/write`](#operation/PostV1Write) and [`/query`](#operation/GetV1Query) endpoints in InfluxDB 3.

- **`[USERNAME]`**: an optional string value (ignored by InfluxDB 3 Cloud Dedicated).
- **`DATABASE_TOKEN`**: a [database token](/influxdb3/cloud-dedicated/admin/tokens/).
- Encode the `[USERNAME]:DATABASE_TOKEN` credential using base64 encoding, and then append the encoded string to the `Authorization: Basic` header.
When authenticating requests, InfluxDB 3 checks that the `password` part of the decoded credential is an authorized token
and ignores the `username` part of the decoded credential.

### Example

The following example shows how to use cURL with the `Basic` authentication scheme and a [database token](/influxdb3/cloud-dedicated/admin/tokens/):

```sh
#######################################
# Use Basic authentication with a database token
# to query the InfluxDB v1 HTTP API
#######################################
# Use the --user option with `--user username:DATABASE_TOKEN` syntax
#######################################

curl --get "http://cluster-id.a.influxdb.io/query" \
```bash
curl "https://cluster-id.a.influxdb.io/write?db=DATABASE_NAME&precision=s" \
--user "":"DATABASE_TOKEN" \
--data-urlencode "db=DATABASE_NAME" \
--data-urlencode "q=SELECT * FROM MEASUREMENT"
--header "Content-type: text/plain; charset=utf-8" \
--data-binary 'home,room=kitchen temp=72 1641024000'
```

Replace the following:

- **`DATABASE_NAME`**: your InfluxDB 3 Cloud Dedicated database
- **`DATABASE_TOKEN`**: a [database token](/influxdb3/cloud-dedicated/admin/tokens/) with sufficient permissions to the database
scheme: basic
type: http
- **`DATABASE_TOKEN`**: a database token with sufficient permissions to the database

#### Related guides

- [Authenticate v1 API requests](/influxdb3/cloud-dedicated/guides/api-compatibility/v1/)
- [Manage tokens](/influxdb3/cloud-dedicated/admin/tokens/)
QuerystringAuthentication:
type: apiKey
in: query
name: u=&p=
description: |
Use the Querystring authentication
scheme with InfluxDB 1.x API parameters to provide credentials through the query string.
Use InfluxDB 1.x API parameters to provide credentials through the query string for v1 API requests.

### Query string authentication
Querystring authentication works with v1-compatible [`/write`](#operation/PostV1Write) and [`/query`](#operation/GetV1Query) endpoints.

In the URL, pass the `p` query parameter to authenticate `/write` and `/query` requests.
When authenticating requests, InfluxDB 3 Cloud Dedicated checks that `p` (_password_) is an authorized database token and ignores the `u` (_username_) parameter.
When authenticating requests, InfluxDB 3 checks that the `p` (_password_) query parameter is an authorized token
and ignores the `u` (_username_) query parameter.

### Syntax

Expand All @@ -2041,11 +2027,20 @@ components:
https://cluster-id.a.influxdb.io/write/?[u=any]&p=DATABASE_TOKEN
```

### Example
### Examples

```bash
curl "https://cluster-id.a.influxdb.io/write?db=DATABASE_NAME&precision=s&p=DATABASE_TOKEN" \
--header "Content-type: text/plain; charset=utf-8" \
--data-binary 'home,room=kitchen temp=72 1641024000'
```

The following example shows how to use cURL with query string authentication and a [database token](/influxdb3/cloud-dedicated/admin/tokens/).
Replace the following:

```sh
- **`DATABASE_NAME`**: your InfluxDB 3 Cloud Dedicated database
- **`DATABASE_TOKEN`**: a database token with sufficient permissions to the database

```bash
#######################################
# Use an InfluxDB 1.x compatible username and password
# to query the InfluxDB v1 HTTP API
Expand All @@ -2062,16 +2057,23 @@ components:

Replace the following:

- **`DATABASE_NAME`**: your InfluxDB 3 Cloud Dedicated database
- **`DATABASE_TOKEN`**: a [database token](/influxdb3/cloud-dedicated/admin/tokens/) with sufficient permissions to the database
- **`DATABASE_NAME`**: the database to query
- **`DATABASE_TOKEN`**: a database token with sufficient permissions to the database

#### Related guides

- [Authenticate v1 API requests](/influxdb3/cloud-dedicated/guides/api-compatibility/v1/)
- [Manage tokens](/influxdb3/cloud-dedicated/admin/tokens/)
BearerAuthentication:
type: http
scheme: bearer
bearerFormat: JWT
description: |

Use the OAuth Bearer authentication
scheme to authenticate to the InfluxDB API.
scheme to provide an authorization token to InfluxDB 3.

Bearer authentication works with all endpoints.

In your API requests, send an `Authorization` header.
For the header value, provide the word `Bearer` followed by a space and a database token.
Expand All @@ -2080,29 +2082,20 @@ components:
### Syntax

```http
Authorization: Bearer INFLUX_TOKEN
Authorization: Bearer DATABASE_TOKEN
```

### Example

```sh
########################################################
# Use the Bearer token authentication scheme with /api/v2/write
# to write data.
########################################################

curl --request post "https://cluster-id.a.influxdb.io/api/v2/write?bucket=DATABASE_NAME&precision=s" \
--header "Authorization: Bearer DATABASE_TOKEN" \
--data-binary 'home,room=kitchen temp=72 1463683075'
```bash
curl https://cluster-id.a.influxdb.io/api/v3/query_influxql \
--header "Authorization: Bearer DATABASE_TOKEN"
```

For examples and more information, see the following:
- [Authenticate API requests](/influxdb3/cloud-dedicated/primers/api/v2/#authenticate-api-requests)
- [Manage tokens](/influxdb3/cloud-dedicated/admin/tokens/)
TokenAuthentication:
description: |
Use the Token authentication
scheme to authenticate to the InfluxDB API.
Use InfluxDB v2 Token authentication to provide an authorization token to InfluxDB 3.

The v2 Token scheme works with v1 and v2 compatibility endpoints in InfluxDB 3.

In your API requests, send an `Authorization` header.
For the header value, provide the word `Token` followed by a space and a database token.
Expand All @@ -2111,7 +2104,7 @@ components:
### Syntax

```http
Authorization: Token INFLUX_API_TOKEN
Authorization: Token DATABASE_TOKEN
```

### Example
Expand All @@ -2129,7 +2122,6 @@ components:

### Related guides

- [Authenticate API requests](/influxdb3/cloud-dedicated/primers/api/v2/#authenticate-api-requests)
- [Manage tokens](/influxdb3/cloud-dedicated/admin/tokens/)
in: header
name: Authorization
Expand Down
2 changes: 1 addition & 1 deletion api-docs/influxdb3/cloud-serverless/v2/ref.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9414,7 +9414,7 @@ components:
Default is [`RFC3339` date/time format](/influxdb3/cloud-serverless/reference/glossary/#rfc3339-timestamp).
To include nanoseconds in timestamps, use `RFC3339Nano`.

#### Example formatted date/time values
### Example formatted date/time values

| Format | Value |
|:------------|:----------------------------|
Expand Down
Loading