rest api login not working

1

Hi all,

When making a login request via REST I am getting back a 200 OK response like this:

HTTP/1.1 200 OK
Date: Thu, 14 Mar 2013 18:50:11 GMT 
Content-Length: 0 
P3P: CP="ALL" 
Content-Type: text/xml;charset=UTF-8 
Server: Apache-Coyote/1.1 
</pre>

but - without a session id...
Oddly - if I am ALREADY logged into jasperserver, it DOES return a session ID like so;

HTTP/1.1 200 OK 
Date: Thu, 14 Mar 2013 18:47:21 GMT 
Content-Length: 0 
P3P: CP="ALL" 
Set-Cookie: JSESSIONID=4278973A7101ECC11A9504EF2107BF4E; 
Path=/jasperserver 
Content-Type: text/xml;charset=UTF-8 
Server: Apache-Coyote/1.1

Which appears to be giving my my current session Id, ok great, but the login is NOT working ?Doesn't make any darn sense...

Here is the code I am using (as well as testing the POST using RestClient tool):

function fRESTLogin() {
    uri_address = "http://{server-address}:8080/jasperserver/rest/login";
    var xmlhttp = new XMLHttpRequest();
    xmlhttp.open("POST",uri_address,true);
    xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
    xmlhttp.send("j_username=jasperadmin&j_password=jasperadmin");
}

Can anyone see what I am doing wrong or incorrectly ?

I couldn't see in the API documentation where I am missing anything in my request....

Of course, I am not using jasperadmin/jasperadmin normally - but have tried it in testing this as shown here

We are running JasperReports Server CE 4.7 on Tomcat 6

bbaley's picture
23
Joined: Dec 9 2011 - 7:28am
Last seen: 1 month 2 days ago
When the above fRestLogin() executes, I get a Dialog like so; Authentication required A Username and password are being requested by The Site Says: "Protected Area" Username Password Upon closing the dialog the browser message is; HTTP Status 401 - Full authentication is required to access this resource This almost seems to be indicating that permissions to the actual REST API are what it's asking for credentials to ? (since I am making a POST request with the login credentials) Does this sound reasonable or likely ?
bbaley - 6 years 8 months ago

1 Answer:

0

Hello,

I know it's an old post but did you find a solution ?

I have a similar issue.

Thank you

julien.moutel's picture
Joined: Jul 6 2017 - 5:02am
Last seen: 2 years 4 months ago
Feedback
randomness