how to get Digital Ocean Access Token and ssh ID
Hi, I'm trying out the Testing Kitchen instructions. I created an Access Token, 'test', on Digital Ocean and created an SSH Key.
then I try to receive the id's with the curl command:
curl -X GET https://api.digitalocean.com/v2/account/keys -H "Authorization: test $DIGITALOCEAN_ACCESS_TOKEN"
but when I run this command, I get an identification failure. I'm not sure what data in the above command to replace with my own data.
Thanks for your help,
Anthony
@acandael Did you run export DIGITALOCEAN_ACCESS_TOKEN=abcdefg before running the curl command?
yeah, on my local machine I ran:
export DIGITALOCEAN_ACCESS_TOKEN=test
export DIGITALOCEAN_SSH_KEY_IDS=test
$ curl -X GET https://api.digitalocean.com/v2/account/keys -H "Authorization: test $DIGITAL_OCEAN_ACCESS_TOKEN"
the error message I'm getting is:
{"id":"unauthorized","message":"Unable to authenticate you."}
@acandael The command needs to be: curl -X GET https://api.digitalocean.com/v2/account/keys -H "Authorization: Bearer <YOUR_DIGITALOCEAN_ACCESS TOKEN>" You have replaced Bearer with test But it needs to be Bearer
@acandael Did this answer your question?
yes, but it didn't solve my issue, I still wasn't able to authenticate.
@acandael Ah ok. So your command looks like:
$ curl -X GET https://api.digitalocean.com/v2/account/keys -H "Authorization: Bearer $DIGITAL_OCEAN_ACCESS_TOKEN"?
What happens if you don't use the exported var, but just entered the token inside the curl command, like so: $ curl -X GET https://api.digitalocean.com/v2/account/keys -H "Authorization: Bearer <your_token>"