chetan t
chetan t

Reputation: 21

How to get Auth-Token in openstack

I installed OpenStack liberty in VM(Virutal Box) and I am trying to get Aut-token and I got some method to get Auth-token from stack overflow so i used that command

curl -d '{"auth":{"passwordCredentials":{"username": "can", "password": "mypassword"}}}' -H "Content-type: application/json" http://localhost/v2.0/tokens

but it is not giving any responses,it just shows

>

in command prompt.could any one explain what is wrong with my steps..

Upvotes: 2

Views: 4349

Answers (2)

IRSHAD
IRSHAD

Reputation: 2933

To get the token using curl command:

curl http://<controller_ip>:5000/v2.0/tokens \
-X POST \
-d '{"auth":{"tenantName":"demo", "passwordCredentials":{"username":"demo", "password":"*****"}}}' \
-H "Content-type: application/json" | python -m json.tool

Upvotes: 1

Charles Farquhar
Charles Farquhar

Reputation: 11

The > character that you see suggests a copy/paste error. You are probably pasting a newline in the middle of your curl command.

The token request you are passing to keystone is fine, however in most cases keystone will be running on port 5000, which you will need to specify in the URL (e.g. http://localhost:5000/v2.0/tokens).

Here is an example of what you should get:

# curl -sd '{"auth":{"passwordCredentials":{"username": "admin", "password": "password"}}}' -H "Content-type: application/json" http://192.168.113.57:5000/v2.0/tokens | python -m json.tool
{
    "access": {
        "metadata": {
            "is_admin": 0,
            "roles": []
        },
        "serviceCatalog": [],
        "token": {
            "audit_ids": [
                "Yk4h80jJTe6jiGKzXFge9Q"
            ],
            "expires": "2016-08-08T03:06:40Z",
            "id": "gAAAAABXp06AlKkt_fxEuDbjW19h4nvwC-7rgEr9Mw4abtc_uUGTm4HSGukUzRf5JYS8Q6J-fexDVLTtA7doaUzkvnLlLSFEfjW0e4IVq3V0rccvU9fLErNcNcWWJNx3pPM1fjBHEvGOlYvwEFmUUXhxl9VHKqO_DQ",
            "issued_at": "2016-08-07T15:06:40.000000Z"
        },
        "user": {
            "id": "732a8637a18b4e91ac9d8a95a8477e05",
            "name": "admin",
            "roles": [],
            "roles_links": [],
            "username": "admin"
        }
    }
}

Upvotes: 1

Related Questions