使用CloudFlare API的身份验证错误

发布于 2025-01-17 09:42:16 字数 676 浏览 1 评论 0原文

我反复收到身份验证错误,就像(不是我)使用CloudFlare API。

curl -X GET "https://api.cloudflare.com/client/v4/zones/<ZONEID>/dns_records?type=A&name=<DOMAIN>&content=127.0.0.1&proxied=undefined&page=1&per_page=20&order=type&direction=desc&match=all" \
 -H "X-Auth-Email: <EMAIL>" \
 -H "X-Auth-Key: <APITOKEN>" \
 -H "Content-Type: application/json"

 {“success”:false,“errors”:[{“code”:10000,“message”:“Authentication error”}]}

我在做什么错?

I repeatedly received an authentication error just like this (not me) when using the Cloudflare api.

curl -X GET "https://api.cloudflare.com/client/v4/zones/<ZONEID>/dns_records?type=A&name=<DOMAIN>&content=127.0.0.1&proxied=undefined&page=1&per_page=20&order=type&direction=desc&match=all" \
 -H "X-Auth-Email: <EMAIL>" \
 -H "X-Auth-Key: <APITOKEN>" \
 -H "Content-Type: application/json"

 {“success”:false,“errors”:[{“code”:10000,“message”:“Authentication error”}]}

What am I doing wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

苄①跕圉湢 2025-01-24 09:42:16

我收到了完全相同的错误消息,我发现我正在使用 api令牌而不是 api键 /代码>参数。

I was getting that exact same error message, and I found out that I was using the API Token instead of the API Key in the X-Auth-Key parameter.

白衬杉格子梦 2025-01-24 09:42:16

显然,似乎有效的唯一方法是使用用户令牌而不是区域。

curl -xpost -h'x-auth-key: 令牌 '-h'x-auth-email: 电子邮件 '-h \“ content -type:application/json \” -d'{\ \“ type \”:\“ cname \”,\ \“ name \”:\“ hi \”, \“ content \”:\“ example.com \”,\“代理\”:true}'https://api.cloudflare.com/client/v4/ Zone_id /dns_records'


Apparently the only way that seems to work is to use the user token instead of the zone one.

curl -XPOST -H 'X-Auth-Key:TOKEN' -H 'X-auth-email:EMAIL' -H \"Content-type: application/json\" -d '{\"type\":\"CNAME\",\"name\":\"hi\",\"content\":\"example.com\",\"proxied\":true}' 'https://api.cloudflare.com/client/v4/ZONE_ID/dns_records'

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文