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

Posted May 30, 2015 5.8k views

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?

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.

Submit an Answer
2 answers

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

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