I'm learning Apigility (Apigility docu -> REST Service Tutorial) and trying to send a POST request with basic authentication via cURL:
$ curl -X POST -i -H "Content-Type: application/hal+json" -H "Authorization: Basic YXBpdXNlcjphcGlwd2Q=" http://apigilityhw.sandbox.loc/status
YXBpdXNlcjphcGlwd2Q=
is the base 64 encoded string with my credentials apiuser:apipwd
. The credentials are saved in the /data/htpasswd
(apiuser:$apr1$3J4cyqEw$WKga3rQMkxvnevMuBaekg/
).
The looks like this:
HTTP/1.1 401 Unauthorized
Server: nginx/1.4.7
Date: Mon, 22 Sep 2014 07:48:47 GMT
Content-Type: application/problem+json
Transfer-Encoding: chunked
Connection: keep-alive
X-Powered-By: PHP/5.5.12-1~dotdeb.1
WWW-Authenticate: Basic realm="api"
Where is the mistake here? How to get it work?
as header
From the documentation page:
http://curl.haxx.se/docs/manpage.html#-u
Note that you do not need
--basic
flag as it is the default.When using OAuth or other authentication services you can often also send your access token in a query string instead of in an authorization header, so something like: