wp remote post – wp_remote_post return 419

Question

I’m trying to interact with my laravel API, the first method is login which doesn’t require any bearer token. I tested with postman and everything works well, unfortunately when I try with wordpress I get:

419 Page expired

From the API.
I suspect there is something from wordpress site that I didn’t set correctly, check my code:

$url = $this->api_endpoint . "https://wordpress.stackexchange.com/" . $action;

$body = [
    'email' => 'test@gmail.com',
    'password' => '123456789'    
]

$response = wp_remote_post($url, [
    'method' => 'POST',
    'body' => $body,
    'headers' => [
        'Content-type: application/x-www-form-urlencoded'
    ]
]);

var_dump($response);
die();

return $response;

0
sfarzoso 4 weeks 2022-08-30T11:27:40-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse