From c359ed6ea9448bbcb5a6d4ec4a706eab199e373f Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Wed, 22 Mar 2017 18:00:41 -0600 Subject: [PATCH] bugfix: cache empty session (without session) --- oauth3.core.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/oauth3.core.js b/oauth3.core.js index 75d6f0e..9b327e8 100644 --- a/oauth3.core.js +++ b/oauth3.core.js @@ -574,7 +574,8 @@ return OAUTH3.PromiseA.resolve( OAUTH3.hooks.session._getCached(providerUri, id) || OAUTH3.hooks.session._get(providerUri, id) ).then(function (session) { - OAUTH3.hooks.session._cache[providerUri + (id || session.id || session.token.id || '')] = session; + var s = session || { token: {} }; + OAUTH3.hooks.session._cache[providerUri + (id || s.id || s.token.id || '')] = session; if (!id) { OAUTH3.hooks.session._cache[providerUri] = session; }