0

I've got an Angular front end calling a REST service to authenticate a user provided by a Fat Free server.

When I use postman I can see the parameters passed in the POST in the f3 route, so:

function authenticate(\Base $f3) {

        $logger = new \Log('app-events.log');            
        $logger->write('authenticate called.');

        $logger->write('username:' . $f3->get('POST.username'));
        $logger->write('username:' . $f3->get('PARAM.username'));

will log the username.

But when I call the same service from my angular front end the parameters are empty.

My server is running version 5.6.17 and I've set always_populate_raw_post_data=-1.

I am stumped and would appreciate any insights.

Thanks Matt

Mattd
  • 95
  • 5
  • 2
    Can you dump `$f3->BODY` and tell what's inside? There are chances that you find json inside. See [this answer](http://stackoverflow.com/a/15485690/2588746). That would explain why PHP can't decode it. You can decode a json body by using `$post=json_decode($f3->BODY,TRUE)`. – xfra35 Feb 08 '16 at 06:52
  • @xfra35 - Spot on! It's a bit of a shame that I need to code for both angular & standard POST front-ends. But thanks - at least I can now get hold of the parameters. – Mattd Feb 09 '16 at 07:17

0 Answers0