I am creating an app with using ionic and drupal web service. I could not be an authenticated user. I am using this code fragment to getting login data:
requestConfig = {
method :'POST',
url : pathToLogin,
headers: {
//@TODO use the format of drupalApiConfig
"Accept" : "application/json",
"Content-Type" : "application/json",
},
data : {
"username" : username,
"password" : password
},
withCredentials: false,
}
After getting login data then I am parsing them and getting data like this:
sessid: "FPbXbDLtei0jRVu6PzGUfgqAuAhd8XrOK2G24RnWreM",
session_name: "SESS3d0229a2305c5756586d8cb91ca04346",
token: "lEZ01gggrGQoQ_kAlzsvY0QzRGs11t2VHKRQg_dThjE",
user: Object
I am using this token with other get operations just like this:
requestConfig = {
method :'GET',
url : indexPath,
withCredentials: false,
headers : {
X_CSRF_TOKEN : token
}
},
However I am getting this error:
GET http://www.exampleDomain.com/api/mobiledata/user?page=1&pageSize=10 403 (: Access denied for user anonymous)
Could anyone explain this problem and its solution?