diff --git a/client/lib/public-key-store.js b/client/lib/public-key-store.js index fbcad1d..354d233 100644 --- a/client/lib/public-key-store.js +++ b/client/lib/public-key-store.js @@ -54,11 +54,6 @@ function obtainToken(client, opts, callback) { // try cache first client.tokenCache.get(cacheKey, function (err, reply) { - if (err) { - callback(err); - return; - } - if (reply) { var data; if (_.isObject(reply)) { diff --git a/package.json b/package.json index 5cb2edd..e94b5ee 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "persona_client", - "version": "4.1.5", + "version": "4.1.6", "private": true, "main": "./index.js", "description": "Node Client for Persona, repsonsible for retrieving, generating, caching and validating OAuth Tokens.", diff --git a/test/unit/public-key-store.js b/test/unit/public-key-store.js index 5083422..e396214 100644 --- a/test/unit/public-key-store.js +++ b/test/unit/public-key-store.js @@ -590,15 +590,17 @@ describe('public-key-store', function() { }); }); - publicKeyStore.obtainToken(personaClient, testOpts, (err) => { + publicKeyStore.obtainToken(personaClient, testOpts, (err, publicKey) => { personaClient.tokenCache.get.calledOnce.should.equal(true); personaClient.tokenCache.get.calledWith(testObtainTokenCacheKey).should.equal(true); - generateTokenStub.called.should.equal(false); + generateTokenStub.calledOnce.should.equal(true); - err.should.equal(error); + generateTokenStub.calledWith(personaClient, testObtainTokenCacheKey, testXRequestId, testOpts.id, testOpts.secret).should.equal(true); + publicKey.access_token.should.equal(testPublicKeyObject.access_token); + publicKey.expires_at.should.equal(testUnexpiredTimestamp); done(); }); });