hey have problem set session on post requests. example, request working corectly. have tried redirect after post request doesn't work too. there sections of code;
not working:
$app->post( '/localauth', 'usercontroller::serviceloginauth' ) ->after( function() { session_name('auth') session_start(); } );
working without redirect in serviceloginauth:
// redirect '/authsuccess' $app->post('/localauth', 'usercontroller::serviceloginauth'); $app->get('/authsuccess', 'usercontroller::serviceloginauthsuccess');
i use http post angular code:
$http({ url: apiconst.apiurl+'/localauth', method: "post", data: $.param({ login: user.login, pass:user.pass }), headers: { 'content-type': 'application/x-www-form-urlencoded; charset=utf-8' } }).then(function(response){ console.log(response); $cookies.put('csrftoken',response.data.token); }).catch(function(){ console.log(err); });
thanks help!
why don't use silex sessionserviceprovider ?
the problem can calling session_start on middleware using ->after
instead of ->before
?
Comments
Post a Comment