Page 1 of 1

Upload file to secure connection - sessionToken is absent or invalid (DBSQ261)

Posted: Thu Jan 29, 2015 9:02 pm
by Yaniv

Hi All,
I switch my DB to use secure connection, and since than I'm getting the following issue:
While trying to upload file to DB I'm getting the following error:

Error: {"message":"Option 'Secure collection with session token' enabled but sessionToken is absent or invalid","code":"DBSQ261"} at Object.query (:25:42) at Object.query (:43:35) at getAllCollection (:54:24) at prepreJSONForSaveIntoTable (:432:29) at :31:28

In the header I tried event to set all permission combination:
"headers": {
"X-Appery-Database-Id": dbId,
"X-Appery-Master-Key": masterKey,
"X-Appery-Session-Token": token,
"content-type":"text/json"
},

Can you tel what is the issue?


Upload file to secure connection - sessionToken is absent or invalid (DBSQ261)

Posted: Thu Jan 29, 2015 9:20 pm
by Illya Stepanov

Hi -

Are you passing session token in your headers?


Upload file to secure connection - sessionToken is absent or invalid (DBSQ261)

Posted: Thu Jan 29, 2015 9:27 pm
by Yaniv

Yes,
Here is the method:

insertJSONInfoFilesTable = function(jsonObjToStore, fileName, dbId, masterKey, token){
var XHRResponse = XHR.send("POST", "https://api.appery.io/rest/1/db/files/"+ fileName + ".json", {
"headers": {
"X-Appery-Database-Id": dbId,
"X-Appery-Master-Key": masterKey,
"X-Appery-Session-Token": token,
"content-type":"text/json"
},

Code: Select all

   "body": jsonObjToStore 

});
};


Upload file to secure connection - sessionToken is absent or invalid (DBSQ261)

Posted: Thu Jan 29, 2015 9:50 pm
by Illya Stepanov

Please check the details here: http://devcenter.appery.io/documentat...


Upload file to secure connection - sessionToken is absent or invalid (DBSQ261)

Posted: Thu Jan 29, 2015 10:59 pm
by Yaniv

Above code if fine, the issue was that I missed to add the token inside inner method.

Thanks!


Upload file to secure connection - sessionToken is absent or invalid (DBSQ261)

Posted: Fri Jan 30, 2015 7:32 am
by Evgene Karachevtsev

Hello Yaniv,

Thank you for the update, glad it works!