Cannot connect to Swift, error 401

Asked by Michael sevy

Using cURL, I can connect and obtain an X-Auth-Token. But when I attempt to connect back for a HEAD request, using the returned X-Auth-Token and X-Storage-URL, I receive a 401, unauthorized response.

I'm using tempauth.

The following is output from the two cURL commands:

[swift@localhost ~]$ curl -i -v -H 'X-Storage-User: test:tester' -H 'X-Storage-Pass: testing' http://192.168.30.128:8080/auth/v1.0
* About to connect() to 192.168.30.128 port 8080 (#0)
* Trying 192.168.30.128... connected
* Connected to 192.168.30.128 (192.168.30.128) port 8080 (#0)
> GET /auth/v1.0 HTTP/1.1
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.14.0.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Host: 192.168.30.128:8080
> Accept: */*
> X-Storage-User: test:tester
> X-Storage-Pass: testing
>
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
< X-Storage-Url: http://192.168.30.128:8080/v1/AUTH_test
X-Storage-Url: http://192.168.30.128:8080/v1/AUTH_test
< X-Storage-Token: AUTH_tk61345b239dd343cb839d5459030cc643
X-Storage-Token: AUTH_tk61345b239dd343cb839d5459030cc643
< X-Auth-Token: AUTH_tk61345b239dd343cb839d5459030cc643
X-Auth-Token: AUTH_tk61345b239dd343cb839d5459030cc643
< Content-Length: 0
Content-Length: 0
< Date: Wed, 06 Nov 2013 22:11:48 GMT
Date: Wed, 06 Nov 2013 22:11:48 GMT

<
* Connection #0 to host 192.168.30.128 left intact
* Closing connection #0
[swift@localhost ~]$ curl -i -v -H 'X-Auth-Token: AUTH_tk61345b239dd343cb839d5459030cc643' http://192.168.30.128:8080/auth/v1.0
* About to connect() to 192.168.30.128 port 8080 (#0)
* Trying 192.168.30.128... connected
* Connected to 192.168.30.128 (192.168.30.128) port 8080 (#0)
> GET /auth/v1.0 HTTP/1.1
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.14.0.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Host: 192.168.30.128:8080
> Accept: */*
> X-Auth-Token: AUTH_tk61345b239dd343cb839d5459030cc643
>
< HTTP/1.1 401 Unauthorized
HTTP/1.1 401 Unauthorized
< Content-Length: 358
Content-Length: 358
< Content-Type: text/html; charset=UTF-8
Content-Type: text/html; charset=UTF-8
< Date: Wed, 06 Nov 2013 22:12:14 GMT
Date: Wed, 06 Nov 2013 22:12:14 GMT

<
<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 />

 </body>
* Connection #0 to host 192.168.30.128 left intact
* Closing connection #0
</html>[swift@localhost ~]$

Question information

Language:
English Edit question
Status:
Solved
For:
OpenStack Object Storage (swift) Edit question
Assignee:
No assignee Edit question
Solved by:
Mehmet Hacısalihoğlu
Solved:
Last query:
Last reply:
Revision history for this message
Best Mehmet Hacısalihoğlu (esedmehmet) said :
#1

hi,

this command("curl -i -v -H 'X-Auth-Token: AUTH_tk61345b239dd343cb839d5459030cc643' http://192.168.30.128:8080/auth/v1.0") is wrong.
you must be use curl -i -v -H 'X-Auth-Token: AUTH_tk61345b239dd343cb839d5459030cc643' http://192.168.30.128:8080/v1/AUTH_test.

Thanks.

Revision history for this message
Michael sevy (michael-sevy) said :
#2

Arrrrr! Thanks. I was trying a couple different things and forgot to copy the returned Storage URL. This did solve my problem. HOWEVER, you can also get the same 401-type error if Swift is running, but memcached is *not*. I think I was running into a situation, yesterday, where I was rebooting my machine and forgetting to start memcached, then (also) forgetting to copy the correct URL.

Have added starting memcached and swift to startup scripts.

Again, thanks for catching an incorrect URL I was blinded from seeing.

-Michael

Revision history for this message
Michael sevy (michael-sevy) said :
#3

Thanks Mehmet Hacısalihoğlu, that solved my question.