今天刚注意到这个问题。
为所有用户生成具有全局范围的 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": [
"您无权查看请求的资源。API 用户名或密钥无效。"
],
"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
}
}