How to export the current Session Token¶
One method to run OpenStack commands via CLI/API (without password) is with a valid session token. To export this, please proceed as follows:
- Login to OpenStack© Management Portal (Horizon)
- Now in the OpenStack Management Portal, click the small arrow in the upper right corner and select Export credentials ,
- Now select the desired Credential Type and the Export Format and click on the Copy to clipboard button.
- Now paste the credentials from the clipboard into your bash terminal.
# Paste credentials to terminal
export OS_AUTH_URL=https://keystone.service.ewcs.ch/v3
export OS_PROJECT_ID=xxxxxxxxxxxxxxxxxxxxxxxxxxx
export OS_PROJECT_NAME="clienta-os-pr1"
export OS_PROJECT_DOMAIN_ID="xxxxxxxxxxxxxxxxxxxxxxxxxxx"
if [ -z "$OS_PROJECT_DOMAIN_ID" ]; then unset OS_PROJECT_DOMAIN_ID; fi
unset OS_TENANT_ID
unset OS_TENANT_NAME
export OS_TOKEN="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
export OS_REGION_NAME="ch-zh1"
if [ -z "$OS_REGION_NAME" ]; then unset OS_REGION_NAME; fi
export OS_INTERFACE=public
export OS_IDENTITY_API_VERSION=3
export OS_AUTH_PLUGIN=token
export OS_AUTH_TYPE=token
Note
The current User Session Token are only valid until their defined expiration (usually 24h).