From 767595d95870eb7cd37fa041708101eead4039db Mon Sep 17 00:00:00 2001 From: Johannes Zellner Date: Thu, 9 Feb 2017 14:47:47 +0100 Subject: store stringified objects in redis for now --- src/auth.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/auth.js b/src/auth.js index 09ec8b7..0338632 100644 --- a/src/auth.js +++ b/src/auth.js @@ -39,8 +39,14 @@ if (process.env.REDIS_URL) { } // overwrite the tokenStore api - tokenStore.get = redisClient.get.bind(redisClient); - tokenStore.set = redisClient.set.bind(redisClient); + tokenStore.get = function (token, callback) { + redisClient.get(token, function (error, result) { + callback(error || null, safe.JSON.parse(result)); + }); + }; + tokenStore.set = function (token, data, callback) { + redisClient.set(token, JSON.stringify(data), callback); + }; tokenStore.del = redisClient.del.bind(redisClient); } else { console.log('Use in-memory token store'); -- cgit v1.2.3