cloudflare-sync icon indicating copy to clipboard operation
cloudflare-sync copied to clipboard

Not able to connect with cloudflare API

Open ligol opened this issue 5 years ago • 8 comments

When I put the Clouflare Api Key, I got that error

cannot get upstream records: error from makeRequest: HTTP status 400: content "{"success":false,"errors":[{"code":6003,"message":"Invalid request headers","error_chain":[{"code":6111,"message":"Invalid format for Authorization header"}]}],"messages":[],"result":null}"

Any idea where it could come from?

ligol avatar Sep 06 '19 18:09 ligol

I have no idea, sorry. Can you provide some steps on how you got your API key from Cloudflare? My API key has Zone edit permissions, that might be a cause? Howe old is your API key?

siennathesane avatar Sep 06 '19 18:09 siennathesane

With this key, i got "cannot get upstream records: error from makeRequest: HTTP status 403: insufficient permissions" Capture d’écran 2019-09-06 à 20 52 09

ligol avatar Sep 06 '19 18:09 ligol

On your API key, if you click the dropdown box, there's a View Summary option, can you click it and verify it has this permission?

image

That's the permission my API key has, and it works for me. Maybe @jgrahamc can connect us with someone that can help if that's not the case. I'm not an expert in their permissions, sorry!

siennathesane avatar Sep 06 '19 19:09 siennathesane

Yes it has that permission. Concerning the ZoneId, you found it in the web url while being on the dns tab of the cloudflare website right?

ligol avatar Sep 07 '19 14:09 ligol

Okay, I found the issue, I'm sorry, my ZoneId was incorrect, I thought it was the key on the url but it seems not.

Maybe the documentation could be improved to tell where is the ZoneId located on cloudflare website. Or maybe the project could add the option to auto discover the ZoneId by calling the ZoneIDByName method.

I could make a PR for that if you want.

ligol avatar Sep 07 '19 14:09 ligol

Or maybe the project could add the option to auto discover the ZoneId by calling the ZoneIDByName method.

Sure, if you want to make a PR for it, that'd be great. :)

siennathesane avatar Sep 09 '19 16:09 siennathesane

Hi, I got the same issue. I've checked that the zone id is correct.

In some way the request is malformed as the HTTP 400 suggest.

yaazkal avatar Sep 09 '19 21:09 yaazkal

So I made a massive update recently, and I'm also getting the HTTP 400 errors, but I'm not 100% sure why. I did some debugging but I didn't see anything that stood out. I'll keep an eye on it, but if you could try the most recent update, that'd be great. Thanks!

siennathesane avatar Jan 28 '20 16:01 siennathesane