chef-repo icon indicating copy to clipboard operation
chef-repo copied to clipboard

how to get Digital Ocean Access Token and ssh ID

Open acandael opened this issue 11 years ago • 6 comments

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 avatar Oct 28 '14 15:10 acandael

@acandael Did you run export DIGITALOCEAN_ACCESS_TOKEN=abcdefg before running the curl command?

jvanbaarsen avatar Oct 28 '14 15:10 jvanbaarsen

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 avatar Oct 29 '14 09:10 acandael

@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

jvanbaarsen avatar Oct 29 '14 11:10 jvanbaarsen

@acandael Did this answer your question?

jvanbaarsen avatar Nov 02 '14 20:11 jvanbaarsen

yes, but it didn't solve my issue, I still wasn't able to authenticate.

acandael avatar Nov 04 '14 13:11 acandael

@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>"

jvanbaarsen avatar Nov 09 '14 11:11 jvanbaarsen