すべてのユーザーに対するグローバルキーでの無効なアクセス

本日、この問題に気づきました。

全ユーザーに対してグローバルスコープで API キーを生成し、トピックを更新すると invalid_access エラーが発生します。

curl --location --request PUT 'https://example.com/t/-/365.json' \
--header 'Api-User: system' \
--header 'Api-Key: ***' \
--header 'Content-Type: application/json' \
--data-raw '{
    "tags": ["awesome-tag"]
}'
{
    "errors": [
        "You are not permitted to view the requested resource. The API username or key is invalid."
    ],
    "error_type": "invalid_access"
}

ただし、ユーザー system に対してグローバル API キーを生成すれば動作します。同じリクエストですが、キーが異なります。

curl --location --request PUT 'https://example.com/t/-/365.json' \
--header 'Api-User: system' \
--header 'Api-Key: DIFFERENT_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "tags": ["awesome-tag"]
}'
{
    "basic_topic": {
        "id": 365,
        "title": "Test topic",
        "fancy_title": "Test topic",
        "slug": "test-topic",
        "posts_count": 6
    }
}

これは Api-User ではなく Api-Username であるべきです。

このヘッダーは「全ユーザー」用の API キーでのみ使用されるため、キーを特定のユーザーにスコープ設定していた場合は動作していました。

ああ、了解です。それは最近変更されたのでしょうか?私はヘッダーが Api-User だと認識していました。

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.