K
K
Kirill Zhilyaev2016-11-21 22:45:17
JavaScript
Kirill Zhilyaev, 2016-11-21 22:45:17

Can a CRSF token be passed through cookies?

No, not in order to send it back to the server through cookies, but in order for js to take the token from the cookie and set it as part of the request?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
lnked, 2016-11-21
@lnked

<meta content="xxx" name="csrf-param">
<meta content="xxx" name="csrf-token">

$.ajaxSetup({
    headers: {
        'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
    }
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question