My application is: app.example.com (Phalcon MVC)
My website is: www.example.com (PHP Native)
I want to app login from website with CSRF but i couldnt solve.
I'm getting CSRF token from application api like that:
public function getCsrfTokenAction()
{
return $this->response->setJsonContent(array(
'key' => $this->security->getTokenKey(),
'value' => $this->security->getToken()
));
}
And application response service like that:
$di->setShared('response', function () {
$response = new Response();
$response->setHeader('Access-Control-Allow-Origin', 'example.com');
$response->setHeader('Access-Control-Allow-Credentials', true);
$response->sendHeaders();
return $response;
});
But this is not working. What missing?
Thanks