Edit:
Ah wait, I misunderstood the question. Do you want to do this without disabling CSRF protection? As Bharat Geleda said: you can make a route that returns only the token and manually copy it to the _token field in the postman.
But I would recommend excluding your api calls from CSRF protection, as shown below, and adding some API authentication later.
What version of laravel are you using?
Laravel 5.2 and higher:
Starting with 5.2, the CSRF token is only required on routes with web middleware. So put your api routes outside the group using web middleware.
See the topic “Default Route File” in the documentation for more information .
Laravel 5.1 and 5.2:
You can exclude routes that should not have CSRF protection in the VerifyCsrfToken , for example:
class VerifyCsrfToken extends BaseVerifier { /** * The URIs that should be excluded from CSRF verification. * * @var array */ protected $except = [ 'api/*', ]; }
See the section "Excluding URIs from the CSRF Protection Section" for details.
Björn
source share