Ask Your Question
0

pass token in rest-api [closed]

asked 2014-10-08 23:56:00 -0500

Akubra gravatar image

I'm doing some testing with the keystone api v.3.

I use: RequestVar = Invoke-RestMethod -Uri https://keystone.rc.nectar.org.au:5000/v3/auth/tokens (https://keystone.rc.nectar.org.au:500...) -Method Post -Body '{"auth": {"identity": {"methods": ["password"], "password": { "user": {"domain": {"id": "default"},"name": "MYNAME", "password": "MYPASSWORD"}}}}}' `-ContentType application/json

This returns a blob of info into RequestVar.

I now want to use that token for additional commands but they fail with "the request you have made requires authentication"

E.g. EndPointsvar = Invoke-RestMethod -Uri https://keystone.rc.nectar.org.au:5000/v3/endpoints (https://keystone.rc.nectar.org.au:500...) -Headers @{"X-Auth-Token"=RequestVar} -ContentType application/json -Method Get

fails with error 401

Same if I use "RequestVar.Token"

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Akubra
close date 2014-10-09 22:50:10.552482

1 answer

Sort by ยป oldest newest most voted
0

answered 2014-10-09 11:50:41 -0500

You are using unscoped token. You need to get token scoped to domain to invoke identity operation. If you are using default policy file then project scoped token wlll also work. I beleive you are using default poilicy file.

Look at the example for project-scoped token: https://github.com/openstack/keystone...

If you use project scoped token it will work.

edit flag offensive delete link more

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2014-10-08 23:56:00 -0500

Seen: 401 times

Last updated: Oct 09 '14