Ask Your Question
0

Need Clarification on POST v3/tokens, as it is raising NotFound while trying to generate a token for a given user and password.

asked 2013-02-04 14:34:02 -0500

harika-vakadi gravatar image

As in v2.0, I am trying to generate a token using v3 too. Below are the steps I have followed

  1. Looking into the keystone source at /opt/stack/keystone/tests# vi test_v3.py

    def get_scoped_token(self): """Convenience method so that we can test authenticated requests.""" # FIXME(dolph): should use real auth return 'ADMIN'

    r = self.admin_request(
        method='POST',
        path='/v3/tokens',
        body={
            'auth': {
                'passwordCredentials': {
                    'username': self.user_foo['name'],
                    'password': self.user_foo['password'],
                },
                'tenantId': self.tenant_bar['id'],
            },
        })
    return r.body['access']['token']['id']
    
  2. Using the same details from above code, I have formed the below curl command

attempt 1:

root@Grizzly-machine1:~# curl -i http://10.233.52.240:35357/v3/tokens -X POST -H "Content-Type: application/json" -Her-Agent: python-keystoneclient" -d'{"auth": {"passwordCredentials": {"username": "admin", "password": "Openstack1",},"tenantId": "6903bc1b63d243b7bb3f450130a94bf1",},}'

Attempt 2:

root@Grizzly-machine1:~# curl -i http://10.233.52.240:35357/v3/tokens -X POST -H "Content-Type: application/json" -H "User-Agent: python-keystoneclient" -d'{"auth": {"passwordCredentials": {"username": "admin", "password": "Openstack1",},"tenantId": "6903bc1b63d243b7bb3f450130a94bf1"}}' HTTP/1.1 400 Bad Request Vary: X-Auth-Token Content-Type: application/json Content-Length: 244 Date: Mon, 04 Feb 2013 19:38:06 GMT

{"error": {"message": "Expecting to find valid JSON in request body. The server could not comply with the request since it is either malformed or otherwise incorrect. The client is assumed to be in error.", "code": 400, "title": "Bad Request"}}root@Grizzly-machine1:~#

While in the case of v2.0 it was like this and it is working fine as below:

root@Grizzly-machine1:~# curl -i http://10.233.52.240:35357/v2.0/tokens -X POST -H "Content-Type: application/json" -H "User-Agent: python-keystoneclient" -d'{"auth":{"passwordCredentials":{"username": "admin", "password": "Openstack1"}}}' HTTP/1.1 200 OK Vary: X-Auth-Token Content-Type: application/json Date: Mon, 04 Feb 2013 19:35:35 GMT Transfer-Encoding: chunked

{"access": {"token": {"issued_at": "2013-02-04T19:35:35.554113", "expires": "2013-02-05T19:35:35Z", "id": "MIICbgYJKoZIhvcNAQcCoIICXzCCAlsCAQExCTAHBgUrDgMCGjCCAUcGCSqGSIb3DQEHAaCCATgEggE0eyJhY2Nlc3MiOiB7InRva2VuIjogeyJpc3N1ZWRfYXQiOiAiMjAxMy0wMi0wNFQxOTozNTozNS41NTQxMTMiLCAiZXhwaXJlcyI6ICIyMDEzLTAyLTA1VDE5OjM1OjM1WiIsICJpZCI6ICJwbGFjZWhvbGRlciJ9LCAic2VydmljZUNhdGFsb2ciOiBbXSwgInVzZXIiOiB7InVzZXJuYW1lIjogImFkbWluIiwgInJvbGVzX2xpbmtzIjogW10sICJpZCI6ICIzYWQ0NTY0ZThkYTg0NzE0YTQ4MDNlOGQ3YmIxODc3ZiIsICJyb2xlcyI6IFtdLCAibmFtZSI6ICJhZG1pbiJ9LCAibWV0YWRhdGEiOiB7ImlzX2FkbWluIjogMCwgInJvbGVzIjogW119fX0xgf8wgfwCAQEwXDBXMQswCQYDVQQGEwJVUzEOMAwGA1UECBMFVW5zZXQxDjAMBgNVBAcTBVVuc2V0MQ4wDAYDVQQKEwVVbnNldDEYMBYGA1UEAxMPd3d3LmV4YW1wbGUuY29tAgEBMAcGBSsOAwIaMA0GCSqGSIb3DQEBAQUABIGAehzQaH7PsF1mudye51-SbYlw9KCaywtxMiQUfRJJWOXKsIu9Yy1Riizo07Sk-RAKrKTr0vQ5g6EDnK7llRI2ngGyPTn6i7+8aP3UJiuWqVghhOEe7QIg-MA7rlZKny8QMNajcOFK1J2yBJGMoPQM94pK6jJsZO7lAFbWUDVXpeI="}, "serviceCatalog": [], "user": {"username": "admin", "roles_links": [], "id": "3ad4564e8da84714a4803e8d7bb1877f", "roles": [], "name": "admin"}, "metadata": {"is_admin": 0, "roles": []}}}

Can anyone please guide me on how to follow up on this(v3 API POST tokens)

Thanks in advance, Harika

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
0

answered 2013-02-18 12:00:54 -0500

harika-vakadi gravatar image

Thanks gordon chung, that solved my question.

edit flag offensive delete link more
0

answered 2013-02-15 17:02:16 -0500

chungg gravatar image

v3 tokens have yet to be implemented. if you want to track its progress a solution is being worked on here: https://review.openstack.org/#/c/21487/

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2013-02-04 14:34:02 -0500

Seen: 33 times

Last updated: Feb 18 '13