Persistent client does not automatically refresh the token
I am using persistent client to ensure the always availablity of client. It written in documentation it writes tokens in token store. But my store is empty.
My code is
* Read the user's tokens from the store
* @param {Function} callback Passed the user's tokens
* @returns {void}
*/
read: function(callback) {
console.log('read')
try {
let token = JSON.parse(Elastic.readDoc("tokenStore", 1)._source.token)
callback(null, token);
} catch (error) {
callback(error)
}
},
/**
* Write the user's tokens to the store
* @param {Object} tokenInfo The user's token info
* @param {Function} callback The callback
* @returns {void}
*/
write: function(tokenInfo, callback) {
console.log('write')
try {
Elastic.indexDoc("tokenStore", 1, {token :JSON.stringify(tokenInfo)});
// store.set('token', tokenInfo);
callback();
} catch (error) {
callback(error)
}
},
/**
* Clears the user's tokens from the store
* @param {Function} callback The callback
* @returns {void}
*/
clear: function(callback) {
console.log('clear')
try {
Elastic.deleteDoc("tokenStore", 1)
callback();
} catch (error) {
callback(error)
}
}
Post is closed for comments.
Comments
1 comment