DNS Create Request works in Postman but not NodeJS

I always get a
{
success: false,
errors: [ { code: 10000, message: 'Authentication error' } ]
}
{
success: false,
errors: [ { code: 10000, message: 'Authentication error' } ]
}
when making requests via my Node app but the same works in Postman which makes no sense cause I have copied the code from Postman into my Node app. I have tried fetch and axios but both return the same error. Here’s the code
return axios
.request({
method: 'post',
url: 'https://api.cloudflare.com/client/v4/zones/${zoneId}/dns_records',
headers: {
Authorization: `Bearer ${apiKey}`
},
data: {
"name": "${name}",
"type": "TXT",
"content": "dnslink=/ipfs/${cid}"
}
return axios
.request({
method: 'post',
url: 'https://api.cloudflare.com/client/v4/zones/${zoneId}/dns_records',
headers: {
Authorization: `Bearer ${apiKey}`
},
data: {
"name": "${name}",
"type": "TXT",
"content": "dnslink=/ipfs/${cid}"
}
Any help is appreciated!
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server