CSRF token error while working with REST Api in codeigniter

Viewed 474

I'm working in codeigniter v3 and i got error when i use CSRF token while working with REST API in postman error looks like this..

enter image description here

Can anybody help me with this. Also i want to disable CSRF protection for several urls. I tried to achieve this by placing the url in

$config['csrf_exclude_uris'] = array('webservice');

but it still not working.

1 Answers

You need to specify the full uri like this:

$config['csrf_exclude_uris'] = array(
    'webservice/addCandidate'
);

Or with regex :

$config['csrf_exclude_uris'] = array(
    'webservice/[a-zA-Z]+'
);
Related