Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to work with enable codeigniter csrf_protection #106

Open
mdsirr opened this issue Jan 30, 2016 · 2 comments
Open

How to work with enable codeigniter csrf_protection #106

mdsirr opened this issue Jan 30, 2016 · 2 comments

Comments

@mdsirr
Copy link

mdsirr commented Jan 30, 2016

When I set TRUE in $config['csrf_protection']($config['csrf_protection'] = TRUE;). It doesn't work. How to fix it please give me suggestion.

@ichadhr
Copy link

ichadhr commented Feb 3, 2016

You must set cookies on ajax call, try this:

"ajax": {
    "url": "whatever",
    "type": "POST",
    "data": {
        yours_csrf_token_name: Cookies('yours_csrf_cookie_name')
    }
},

you need to load https://github.com/js-cookie/js-cookie on your views.

@mdsirr
Copy link
Author

mdsirr commented Feb 7, 2016

Thank you so much @ichadhr its working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants