Closed arderyp closed 2 years ago
I'm wondering if authentication may be the issue. When I changed the endpoint from json to html and rePOST, I get a 302 redirect to my authentication page.
Is there any way around this?
im using the symfony 4.4 recomended approach for logging my client in (not logging in via clicking through the actual login page)
// Create CasUser object from first admin Users entity found in DB
$this->user = $this->getFirstAdminUserEntity();
$guardUser = new GuardUser();
$guardUser->hydrateFromUsersEntity($this->user);
// Configure client
$this->client->followRedirects();
$token = new UsernamePasswordToken($guardUser, null, $this->firewall, $guardUser->getRoles());
self::$container->get('security.token_storage')->setToken($token);
$session = self::$container->get('session');
$session->set("_security_{$this->firewall}", serialize($token));
$session->save();
$cookie = new Cookie($session->getName(), $session->getId());
$this->client->getCookieJar()->set($cookie);
Posting via a traditional form works with no issue.
I've tracked down the issue. I don'y think it has to do with panther, but is an somehow related to the _format
special routing token: https://symfony.com/doc/current/routing.html#special-parameters
If I strip that logic from my route, the ajax posts just fine.
I have a link on my page with a specific class. a javascript listener waits for links with this class to be clicked and, when clicked, grabs the associated
data-*
attributes and submits a POST ajax query to the linkshref
. This works for me when browsing my site. However, when the following, I get a 404 Not Found in the console log, even though the path is indeed there:The fact that I'm seeing the POST 404 in the console log suggests my javascript is indeed being executed, so that's not the issue. Also, when I browse the the page in question in my browser, and I paste the following into my console bar, the ajax POST is issued and completed successfully:
Is there some configuration I need to enable on the Panther client to allow ajax requests or something?