aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/auth.js10
1 files changed, 8 insertions, 2 deletions
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) {
39 } 39 }
40 40
41 // overwrite the tokenStore api 41 // overwrite the tokenStore api
42 tokenStore.get = redisClient.get.bind(redisClient); 42 tokenStore.get = function (token, callback) {
43 tokenStore.set = redisClient.set.bind(redisClient); 43 redisClient.get(token, function (error, result) {
44 callback(error || null, safe.JSON.parse(result));
45 });
46 };
47 tokenStore.set = function (token, data, callback) {
48 redisClient.set(token, JSON.stringify(data), callback);
49 };
44 tokenStore.del = redisClient.del.bind(redisClient); 50 tokenStore.del = redisClient.del.bind(redisClient);
45} else { 51} else {
46 console.log('Use in-memory token store'); 52 console.log('Use in-memory token store');