core: Unable to setup Cloudflare integration

The problem

Hi guys, I’m trying to migrate cloudflare to the new integration. I’ve created a new token with the right scopes but when I put it into the integration settings I receive Failed to connect error.

What am I doing wrong?

Environment

  • Home Assistant Core release with the issue: 0.117.0
  • Last working Home Assistant Core release (if known): 0.116.4
  • Operating environment (OS/Container/Supervised/Core): Home Assistant Container
  • Integration causing this issue: cloudflare
  • Link to integration documentation on our website: https://www.home-assistant.io/integrations/cloudflare/

Problem-relevant configuration.yaml


Traceback/Error logs


Additional information

Token is active:

$ curl -s "https://api.cloudflare.com/client/v4/user/tokens/verify" \
-H "Authorization: Bearer MYTOKEN" \
-H "Content-Type:application/json" | jq -r .result.status
active

and with right scopes:

Schermata 2020-10-29 alle 09 11 48

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 20 (15 by maintainers)

Most upvoted comments

Awesome! TY @ludeeus

Yes @maxcanna https://api.cloudflare.com/#user-api-tokens-create-token

curl -X POST "https://api.cloudflare.com/client/v4/user/tokens" \
     -H "Authorization: Bearer xxxxxxxxxxxxxxx" \
     -H "Content-Type: application/json" \
     --data '{"name":"test","policies":[{"effect":"allow","resources":{"com.cloudflare.api.account.zone.*":"*"},"permission_groups":[{"id":"xxxxxxxxxxxxxxx","name":"Zone Read"}]},{"effect":"allow","resources":{"com.cloudflare.api.account.zone.xxxxxxxxxxxxxxx":"*"},"permission_groups":[{"id":"xxxxxxxxxxxxxxx","name":"Zone Write"},{"id":"xxxxxxxxxxxxxxx","name":"DNS Read"}]}]}'

The first policy is creating read access to all zones, the second policy is creating read/write to a single zone.

It needs to be able to read/list all zones so you can choose the correct one on the second screen.

CF does not offer that level of granulated permissions in their UI. You can create a token with their API if you want that.

Same problem, thought it could be AdGuard Home but disabling it didn’t help… My token is also checked and active