On my application I need to extend the user session, but Sync Gateway REST Api don’t have a put method to extend the expiration time.
And I’m creating a function to update the expiration meta data of the session document direct on the database.
Something like this
var couchbaseObj = require('couchbase')
var clusterObj = new couchbaseObj.Cluster('couchbase://127.0.0.1')
// For Couchbase > 4.5 with RBAC Auth
clusterObj.authenticate('user', 'password')
var bucketObj = clusterObj.openBucket('data')
bucketObj.getAndTouch(sessionKey, 10000, function (err, result) {
if (err) {
return(err)
}
return(null)
})
My question is, what is the risk of doing this? Is there a better way to update the session expiration time on Sync Gateway? Why Sync Gateway don’t have a put method to update session?