Can't access Quantum services via REST requests

Asked by Jasmeet Bhatia

I can't seem to access the quantum services via the REST requests. The quantum CLI client works just fine. Also the non-quantum REST services work fine with the authentication credentials..

curl -d '{"auth":{"passwordCredentials":{"username": "admin", "password": "os"}}}' -H "Content-type: application/json" http://172.23.220.36:9696/v2.0/networks

Returns
<html>
 <head>
  <title>401 Unauthorized</title>
 </head>
 <body>
  <h1>401 Unauthorized</h1>
  This server could not verify that you are authorized to access the document you requested. Either you supplied the wrong credentials (e.g., bad password), or your browser does not understand how to supply the credentials required.<br /><br />
Authentication required

Question information

Language:
English Edit question
Status:
Solved
For:
neutron Edit question
Assignee:
No assignee Edit question
Solved by:
Akihiro Motoki
Solved:
Last query:
Last reply:
Revision history for this message
Akihiro Motoki (amotoki) said :
#1

If your quantum server is configured to use keystone auth (it is default in Folsom), you need to fetch a valid token from keystone before accesing quantum server.

Command lines are here when I tested: http://paste.openstack.org/show/24745/

I hope it will help you.

Revision history for this message
Vikas Deolaliker (vikasd) said :
#2

Akihiro,

When you fetch the token in your example, where did you use them in your rest calls?

Revision history for this message
Best Akihiro Motoki (amotoki) said :
#3

"id" returned by token-get should be passed as X-Auth-Token in REST call.

In my last command line, "X-Auth-Token: dcf3d36161154f9faedcec7d16cc01ff" should be "X-Auth-Token: f21fb6ffde104696ad5a3c854391ce75".

I did a mistake when I prepared the command lines to paste them. I reused the previous command line without updating the token. The previous token "dcf3d36161154f9faedcec7d16cc01ff" is also valid in this case.

Revision history for this message
Jasmeet Bhatia (jasmbhat) said :
#4

Thanks Akihiro Motoki, that solved my question.