AnsweredAssumed Answered

Pentaho REST API: Issue when using Pentaho Cookie-Based Authentication

Question asked by Pierre Lati on Nov 20, 2018
Latest reply on Nov 21, 2018 by Pierre Lati

Hello,

 

Been struggling with this for a while, so any help is really appreciated...

I have Pentaho reports loaded into Pentaho Server. These reports are called via an Iframe.

What I'm trying to do is have the user authenticate one time only, so he can run other reports without having to reauthenticate. For that, I use Pentaho Cookie-Based Authentication as documented here: https://help.pentaho.com/Documentation/8.0/Developer_Center/REST_API

My issues are: 1) I wrote a small php script that sends a POST request to /pentaho/j_spring_security_check. The scripts does not return any error, but does not redirect me to home page as expected.

<?php 
$data = array("j_username"=>"admin", "j_password"=>"password", "locale"=>"en_US");
 $string = http_build_query($data); 
echo $string; 
$ch = curl_init("http://localhost:8080/pentaho/j_spring_security_check");
 curl_setopt($ch, CURLOPT_POST, true); 
curl_setopt($ch, CURLOPT_POSTFIELDS, $string); 
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); 
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
echo $ch; 
$return = curl_exec($ch); 
echo $return; 
if (curl_errno($ch)) { 
     print curl_error($ch); 
} 
curl_close($ch); 
?>

 

2) I tried typing directly in the browser "http://localhost:8080/pentaho/j_spring_security_check?j_username=admin&j_password=password", I get the "login_error=1" result, while both logins and passwords are correct (the expected behaviour is to be redirected to the home page).

It's the first time I'm using REST API, so I might be doing things wrong.

Many thanks

Outcomes