API login returns bogus Session-Id

Support requests, bug reports, etc. go here. Dedicated servers / VDS hosting only
granted
Bear Rating Trainee
Bear Rating Trainee
Posts: 1
Joined: 14 Feb 2014, 21:50

API login returns bogus Session-Id

Postby granted » 14 Feb 2014, 22:34

Hello everyone,
I've run into a rather strange problem. When trying to obtain a session-id through the API, I get "your-session-id" as the value for session_id.
I am writing a Chrome Extension that is meant to interact with the API (tt-rss v1.11) via jQuery. I am hosting the tt-rss instance on my Arch Linux VPS. I am still in the testing phase so this is just a snippet:

Code: Select all

function sendLoginRequest()
{
    $.ajax({
        type: "POST",
        url: "http://xxxxx/tt-rss/api/",
        data: '{"op":"login","user":"xxxxx","password":"xxxxx"}',
        contentType: 'application/json; charset=utf-8',
        dataType: 'text',
        success: function(data){
            alert(data);
        }
    });
}

Now if I run above code in the browser the value I get for session_id is "your-session-id". The JSON that is returned is this:

Code: Select all

{"seq":0,"status":0,"content":{"session_id":"your-session-id","api_level":8}}


Oddly enough, if I send the same request with curl from my local machine I get a proper session_id:

Code: Select all

curl -d '{"op":"login","user":"xxxxx","password":"xxxxxx"}' http://xxxxxxxx/tt-rss/api/

returns

Code: Select all

{"seq":0,"status":0,"content":{"session_id":"tqf7772gfmc74565j0lep4pte2","api_level":8}}


I'd appreciate any help.

//EDIT:
As it turns out deleting the cookies in the browser actually resolved this issue. I'm assuming if the API script finds a cookie with the Session Id it will respond with "your-session-id". Not sure if that's on purpose. Anyways, problem solved :)

Return to “Support”

Who is online

Users browsing this forum: No registered users and 7 guests