Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authorization not working #40

Closed
VanishMax opened this issue Mar 29, 2022 · 3 comments · Fixed by #41
Closed

Authorization not working #40

VanishMax opened this issue Mar 29, 2022 · 3 comments · Fixed by #41
Labels
bug Something isn't working

Comments

@VanishMax
Copy link
Contributor

Describe the bug
I've tried to use the Action with all provided secret keys, but the authorization on CloudFlare didn't work.

To Reproduce
Steps to reproduce the behavior:

  1. Do everything like in the docs. The API token of CloudFlare is made only to access the Pages of the account, read access.

Expected behavior
The action works

Additional context
The action calls the https://api.cloudflare.com/client/v4/accounts/***/pages/projects/project-name/deployments API method of CloudFlare with the X-Auth-Key and X-Auth-email headers. This request returns the 400 error with 10000 (Unauthorized) status inside the return data.

I've tried requesting this method from Postman, and here's what I've found. As it is said in the CloudFlare community, the Authorization header works better than other header when we access the CloudFlare API.

I propose changing this logic in the action code. In this case, the CLOUDFLARE_ACCOUNT_EMAIL variable won't be needed at all.

I can make the PR solving this issue, if you agree with the changes.

@PatrickHeneise
Copy link
Member

Strange, thanks for raising the issue! According to their docs, X-Auth-Key is the "official" authentication method.

I guess an easy, non-breaking change would be to check if the email is set, and if not, use the Authorization header, otherwise stick to X-Auth-Key, what do you think?

@PatrickHeneise PatrickHeneise added the bug Something isn't working label Mar 29, 2022
@VanishMax
Copy link
Contributor Author

Sounds great! That might cover many corner cases

@PatrickHeneise
Copy link
Member

Could you prepare a PR for that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging a pull request may close this issue.

2 participants