bugfix: cache empty session (without session)

This commit is contained in:
AJ ONeal 2017-03-22 18:00:41 -06:00
parent 5ed05f03cf
commit c359ed6ea9
1 changed files with 2 additions and 1 deletions

View File

@ -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;
}