I have a node.js application that is built on top of the hackathon starter framework (which people can demo at http://hackathonstarter.herokuapp.com/).
I would like to set it up such that a person can login on the iOS application and use the web application database.
When I login to the application the request body includes the following, which is what is then used to authenticate the user.
body:
{ _csrf: 'a2OrandomxnpwVOrandomp0u36randomorlv0=',
email: 'myEmail@gmail.com',
password: 'myPassword' },
I tried making an ajax request in the console of the site in the following format and it was successful in authenticating me:
$.ajax({
type:"POST",
url:"/login",
data: { _csrf: 'a2OrandomxnpwVOrandomp0u36randomorlv0=',
email: 'myEmail@gmail.com',
password: 'myPassword' },
dataType:"json",
success:function(response){
console.log(response)
}
});
From this I've concluded (hopefully correctly) that in order to accept the request from an external application the request must include a valid _csrf token, which leads me to the question What will the iOS application's request look like, and where will it get a csrf token that will be valid for my application?
The problem is similar to the following: