Open tnier01 opened 2 years ago
nginx-cors.conf
of the o2r-uiPOST
and GET
add_header 'Access-Control-Allow-Origin' 'http://localhost:8000' always;
and add_header 'Access-Control-Allow-Credentials' 'true' always;
needs to be set localhost
whereby OJS is running on http://localhost:8000
a example request could be
var data = new FormData();
data.append("compendium_id", "COMPENDIUM_ID");
$.ajax({
type: 'POST',
data: data,
processData: false,
contentType: false,
url: 'http://localhost/api/v1/job',
xhrFields: {
withCredentials: true
}}).done(function(res) {
console.log(res);
});
6fa26d7d454e367a7e8a47db6e48eead15b53420
At the moment this is solved by a input by the user. The user needs to input the current connect.sid
of the o2r service in the plugin settings.
The idea here is that the user needs to be logged in on the o2r server in the same browser session where he is using OJS. Then the
connect.sid
of the o2r cookie can be used in OJS to enable requests to the o2r server.old idea:
connect.sid
connect.sid
in requestwhoami
to control if the user is currently login on the o2r severidea currently used:
connect.sid
connect.sid
, so catch the corresponding error