Working with Keystone Authenticate

Here is a little utility I’ve worked up while working with the Openstack Keystone code.

To extract the token out of the JSON, use the following pyton script


from sys import stdin
import json
print json.load(stdin)['access']['token']['id']

Which I save in ~/bin/

Here’s the Curl to fetch a token from Keystone, assuming you ‘ve loaded up the sample data from the unit tests:

curl -v   -H "Content-Type:application/json"  -s  -H "Accept:applicaton/json"  -d '{"auth":{"passwordCredentials":{"userId":"foo", "password":"foo2"} ,"tenantName":"bar"}}'   -X POST  | ~/bin/

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.