Authenticating problems with API

General support for problems installing or using Deluge
Post Reply
csgnyc
New User
New User
Posts: 6
Joined: Mon Aug 22, 2016 10:54 pm

Authenticating problems with API

Post by csgnyc »

I have been through these boards, and I think I'm following instructions.

If I enter

Code: Select all

curl -c cookies.txt --compressed -i -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d '{"method": "auth.login", "params": ["deluge"], \"id\": 1}' http://192.168.1.10:8112/json
I get a response that includes session_id.

If I then enter

Code: Select all

curl -b cookies.txt --compressed -i -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d '{"method": "web.connected", "params": [], "id": 1}' http://192.168.1.10:8112/json
I get a "not authenticated" message. I have tried other commands and get the same error.

My web interface for deluge is at 192.168.1.10:8112, but I note that 192.168.1.10:8112/json is an empty page. I'm on a synology if that makes a difference.
Cas
Top Bloke
Top Bloke
Posts: 3679
Joined: Mon Dec 07, 2009 6:04 am
Location: Scotland

Re: Authenticating problems with API

Post by Cas »

Please provide actual response
csgnyc
New User
New User
Posts: 6
Joined: Mon Aug 22, 2016 10:54 pm

Re: Authenticating problems with API

Post by csgnyc »

This is the response:

Code: Select all

HTTP/1.1 200 OK
Transfer-Encoding: chunked
Date: Mon, 15 May 2017 23:24:44 GMT
Content-Encoding: gzip
Content-Type: application/x-json
Server: TwistedWeb/16.6.0

{\"id\": 1, \"result\": null, \"error\": {\"message\": \"Not authenticated\", \"code\": 1}}
csgnyc
New User
New User
Posts: 6
Joined: Mon Aug 22, 2016 10:54 pm

Re: Authenticating problems with API

Post by csgnyc »

I figured out a fix -- I specified where to store the cookies.txt file in both codes.

So, for the first code I used

Code: Select all

curl -c /tmp/cookies.txt --compressed -i -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d '{"method": "auth.login", "params": ["deluge"], \"id\": 1}' http://192.168.1.10:8112/json
, and for the second code I used

Code: Select all

curl -b /tmp/cookies.txt --compressed -i -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d '{"method": "web.connected", "params": [], "id": 1}' http://192.168.1.10:8112/json
, and everything seems to work.
Cas
Top Bloke
Top Bloke
Posts: 3679
Joined: Mon Dec 07, 2009 6:04 am
Location: Scotland

Re: Authenticating problems with API

Post by Cas »

Glad you sorted it :)
Post Reply