Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Discussion options

You must be logged in to vote

Here's how I made it work:

framework:
    form:
        csrf_protection:
            token_id: submit

    csrf_protection:
        check_header: true
        stateless_token_ids:
            - submit
            - authenticate
            - logout
            - ajax_stateless
// Stateless CSRF 
// based on csrf_protection_controller.js
const csrfCokieName = 'csrf-token';

axiosInstance.interceptors.request.use(
    config => 
    {
        config.statelessCsrfToken = generateCsrfTokenAndSetCookie();
        config.headers[csrfCokieName] = config.statelessCsrfToken;
        return config;
    }, 
    (error) => 
    {
        removeCsrfCookie(error.config.statelessCsrfToken);
        return 

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@DavidPetrasek
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by DavidPetrasek
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants