Add project scoped token when obtaning token

Currently, when using script federated_login.sh, it will throw
error about using a project scoped token. This patch aim to provide
missing project scoped token when using in k2k system.

Change-Id: I79ead3a6c553754fbd2e37e7c1a2f6958e6bff14
Closes-Bug: #1561875
This commit is contained in:
Hieu LE 2016-03-25 14:52:11 +07:00 committed by Jesse Pretorius (odyssey4me)
parent 9879f3955c
commit 6d3eea3058
1 changed files with 1 additions and 1 deletions

View File

@ -67,7 +67,7 @@ fi
echo Performing federated login...
# obtain a scoped token from the identity provider
curl -v -s -X POST -H "Content-Type: application/json" -d '{"auth":{"identity":{"methods":["password"],"password":{"user":{"name":"'"$OS_USERNAME"'","password":"'"$OS_PASSWORD"'","domain":{"name":"'"$OS_USER_DOMAIN_NAME"'"}}}}}}' $OS_AUTH_URL/auth/tokens >token.json 2>token.txt
curl -v -s -X POST -H "Content-Type: application/json" -d '{"auth":{"scope": {"project":{"domain": {"name": "'"$OS_DOMAIN_NAME"'"}, "name": "'"$OS_PROJECT_NAME"'"}},"identity":{"methods":["password"],"password":{"user":{"name":"'"$OS_USERNAME"'","password":"'"$OS_PASSWORD"'","domain":{"name":"'"$OS_DOMAIN_NAME"'"}}}}}}' $OS_AUTH_URL/auth/tokens >token.json 2>token.txt
if [ "$?" != "0" ]; then
echo "Could not obtain IdP token, did you forget to import your openrc file? See token.json and error.log for details."
exit 1