Hello,
I'm currently writing an 2FA app for owncloud, I load a script on the challenge.php page that should contact the owncloud server using an ajax request to do the authentication but I always get an HTTP 303 status.
Below is the code I use in the script :
function ajaxRequest(params) { $.ajax( { url: OC.generateUrl('/apps/myapps/echo'), type: 'POST', data: { echo: "test", }, dataType: 'json', success: function(response) { console.log(response.echo);} error: function() { console.log('error sp');} }); return false; };
The route in routes.php is : ['name' => 'page#do_echo', 'url' => '/echo', 'verb' => 'POST']
And for the page controller (PageController.php), the function is :
/** * @NoAdminRequired */ public function doEcho ($echo) { return new DataResponse(['echo' => $echo]); }
So far the only answer I got from my server is an 303 http status. Did I miss something when writing my code ?