dwyl / dwyl/learn-phoenix

Making http requests with javascript

Open
#89 0 comments 2 reactions 0 assignees View on GitHub
help wanted question starter
Dominant language
No language data
Stars
664
Forks
41
PR merge metrics
No merged PRs in 30d

Description

When we make a request to the phoenix server, we have to include a csrf_token to avoid cross site forgery. Normally this is fine, as the csrf token is included in all Phoenix forms as a hidden input, but when we are making AJAX requests with javascript, we need to manually include this token.

We can do this by getting the child of the form with the correct name ("_csrf_token") and sending the value of that form in a request header with the name "x-csrf-token".

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.