How exactly to manually pass a token via CLI?

asked 2017-08-08 10:32:27 -0600

Della gravatar image


I've read previous questions like ( and ( but I still can't quite figure out how to pass a token via CLI.

I understand how to set environment variables and do commands using OS_USERNAME and OS_PASSWORD, but I can't quite get OS_TOKEN to work.

What I do is first issue myself a token with openstack token issue, then take the text in the "id" field and put it in my next command, export OS_TOKEN=gAA.... Then I unset OS_USERNAME and OS_PASSWORD, and try a command like openstack user list, and get the error "Missing parameters: Set a username with --os-username, OS_USERNAME, or auth.username. But if I keep OS_USERNAME as an environment variable, it prompts me for the password and doesn't use the token!

What am I missing here? Thanks.

edit retag flag offensive close merge delete


I think it depends on the auth_type configured for the services, usually set to "password". I only use tokens for curl, if I want to use the API directly, e.g. to configure a new domain using something like...

eblock gravatar imageeblock ( 2017-08-09 02:50:18 -0600 )edit

(sorry, formatting doesn't work)

curl -s -X PUT -H "X-Auth-Token: <token_id>" -H "Content-Type: application/json" - d { "config": { "identity": { "driver": "ldap" ... } http://control:35357/v3/domains/<doma...< a=""></doma...<></token_id>

eblock gravatar imageeblock ( 2017-08-09 02:54:20 -0600 )edit