2

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..

chetan t
  • 21
  • 1
  • 3

2 Answers2

1

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"
        }
    }
}
  • Ya. I will try this Thank u so much – chetan t Aug 10 '16 at 03:58
  • I tried the above command you specified and it worked also and I got the output and I used id as Auth-token for PUT method – chetan t Aug 15 '16 at 15:49
  • curl -i -X PUT "X-Auth-Token:bcced26a96304e8197fa85e110df9aa2" http://169.0.0.11/dashboard/project/containers/test/mymusic but its saying that Could not resolve host: X-AUTH-TOKEN HTTP/1.1 301 MOVED PERMANENTLY can you help me to solve this problem please – chetan t Aug 15 '16 at 15:50
1

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
IRSHAD
  • 2,855
  • 30
  • 39