Question

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

Posted May 30, 2015 4k views
API

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}' "https://api.digitalocean.com/v2/droplets" 

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"}' "https://api.digitalocean.com/v2/droplets/5490611/actions"

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.

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” “https://api.digitalocean.com/v2/droplets/1654916

Submit an Answer