API: Reset Password on Droplet fails with "Unable to authenticate you."

These commands create a droplet successfully

$ export TOKEN="faa02e8485a1536a8ff770a4db2bd6f690d5ea88da66blahbla"
$ curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $TOKEN" -d '{"name":"git","region":"nyc3","size":"512mb","image":"ubuntu-14-04-x64","ssh_keys":null,"backups":false,"ipv6":true,"user_data":null,"private_networking":null}' "" 

The returned droplet is (for example) number 5490611. We know then that $TOKEN is my correct API key. So then I try to reset the password:

curl -X POST -H 'Content-Type: application/json' -H 'Authorization: Bearer $TOKEN' -d '{"type":"password_reset"}' ""

However, I get this error returned: {“id”:“unauthorized”,“message”:“Unable to authenticate you.”}

Why is my password reset failing?

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

I am getting same error and i am not using single quotes curl -X GET -H “Content-Type: application/json” -H “Authorization: Bearer 401dce8675a027ea0” “

you are using single quotes in the second command, double quotes in the top command. the single quotes prevent the expansion of $VARIABLES.