Project

General

Profile

RestAPI basic auth

Added by Kevin Williams almost 10 years ago

I'm looking for help with using basic HTTP auth with the Redmine API.

In Adminstration, Settings, Repositories I checked the box for "Enable WS for repository management" and clicked "Generate a Key".

A client application called HockeyApp can use the Redmine API, so in HockeyApp I entered my Redmine URL and the API key. It comes back with a message that I need to check my credentials.

So, to debug this and check to make sure I have Redmine set up right, I tried using curl to extract a list of projects (I have only one). It comes back with "unauthorized". Will someone help me with a curl command line to get the list of projects using basic auth?

One of the variations I've tried is this:

curl -v -H "Content-Type: application/xml" -X POST --data "" -u <myapikey>:randompassword http://dev.mydomain.com/redmine/projects.xml

Which gives this:

* Adding handle: conn: 0x7fe6c3804000
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x7fe6c3804000) send_pipe: 1, recv_pipe: 0
* About to connect() to dev.mydomain.com port 80 (#0)
*   Trying <ipaddr>...
* Connected to dev.mydomain.com (<ipaddr>) port 80 (#0)
* Server auth using Basic with user '<myapikey>'
> POST /redmine/projects.xml HTTP/1.1
> Authorization: Basic <blahblahblah>=
> User-Agent: curl/7.30.0
> Host: dev.mydomain.com
> Accept: */*
> Content-Type: application/xml
> Content-Length: 0
> 
< HTTP/1.1 401 Authorization Required
< Date: Fri, 16 May 2014 16:07:27 GMT
* Server Apache is not blacklisted
< Server: Apache
< X-Powered-By: Phusion Passenger (mod_rails/mod_rack) 3.0.21
< Cache-Control: no-cache
< X-Runtime: 0.007990
< X-Rack-Cache: invalidate, pass
< X-Request-Id: <blahblahblah>
< X-UA-Compatible: IE=Edge,chrome=1
* Authentication problem. Ignoring this.
< WWW-Authenticate: Basic realm="Redmine API" 
< Status: 401
< Content-Length: 1
< Content-Type: application/xml; charset=utf-8
* HTTP error before end of send, stop sending
< 
* Closing connection 0