@blackbaud/auth-client
Advanced tools
Comparing version 1.3.0 to 1.3.1
@@ -245,9 +245,14 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
} | ||
else { | ||
return tokenInteraction.getToken().then(function (tokenResponse) { | ||
if (!BBAuth.pendingLookupPromise) { | ||
BBAuth.pendingLookupPromise = tokenInteraction.getToken().then(function (tokenResponse) { | ||
BBAuth.expirationTime = new Date().valueOf() + tokenResponse['expires_in'] * 1000; | ||
BBAuth.lastToken = tokenResponse['access_token']; | ||
BBAuth.pendingLookupPromise = null; | ||
return BBAuth.lastToken; | ||
}).catch(function (reason) { | ||
BBAuth.pendingLookupPromise = null; | ||
throw reason; | ||
}); | ||
} | ||
return BBAuth.pendingLookupPromise; | ||
}; | ||
@@ -367,8 +372,7 @@ return BBAuth; | ||
// message that is posted to the omnibar because all other messages will | ||
// be validated against the provided origin. If the origin provided here | ||
// be validated against the provided origin. If the origin of the host page | ||
// does not match a whilelist of allowed origins maintained by the omnibar, | ||
// further communications between the omnibar and host will be blocked. | ||
interop_1.BBAuthInterop.postOmnibarMessage(iframeEl, { | ||
messageType: 'host-ready', | ||
origin: location.origin | ||
messageType: 'host-ready' | ||
}); | ||
@@ -375,0 +379,0 @@ monkeyPatchState(); |
@@ -0,1 +1,5 @@ | ||
# 1.3.1 (2017-04-27) | ||
- Fixed issue where making multiple calls to `BBAuth.getToken()` before the first request completed resulted in multiple token requests. (#15) (Thanks @Blackbaud-MatthewBell!) | ||
# 1.3.0 (2017-04-26) | ||
@@ -2,0 +6,0 @@ |
{ | ||
"name": "@blackbaud/auth-client", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "Provides methods for obtaining an authentication token from the Blackbaud authentication service.", | ||
@@ -5,0 +5,0 @@ "main": "dist/bundles/auth-client.umd.js", |
@@ -16,2 +16,6 @@ # @blackbaud/auth-client | ||
### Prerequisites | ||
The auth client library makes extensive use of [ES6-style Promises](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise), so in order to support browsers that do not yet have native support for Promises (such as Internet Explorer 11) you will need to include a Promise polyfill such as [`es6-promise`](https://github.com/stefanpenner/es6-promise) and use the [auto-polyfill feature](https://github.com/stefanpenner/es6-promise#auto-polyfill) of the library so that `Promise` is added to the global environment. This will need to be loaded on your page before the auth client library. | ||
### ES6/TypeScript | ||
@@ -18,0 +22,0 @@ |
@@ -5,3 +5,4 @@ export declare class BBAuth { | ||
private static expirationTime; | ||
private static pendingLookupPromise; | ||
static getToken(): Promise<string>; | ||
} |
@@ -21,9 +21,14 @@ "use strict"; | ||
} | ||
else { | ||
return tokenInteraction.getToken().then(function (tokenResponse) { | ||
if (!BBAuth.pendingLookupPromise) { | ||
BBAuth.pendingLookupPromise = tokenInteraction.getToken().then(function (tokenResponse) { | ||
BBAuth.expirationTime = new Date().valueOf() + tokenResponse['expires_in'] * 1000; | ||
BBAuth.lastToken = tokenResponse['access_token']; | ||
BBAuth.pendingLookupPromise = null; | ||
return BBAuth.lastToken; | ||
}).catch(function (reason) { | ||
BBAuth.pendingLookupPromise = null; | ||
throw reason; | ||
}); | ||
} | ||
return BBAuth.pendingLookupPromise; | ||
}; | ||
@@ -30,0 +35,0 @@ return BBAuth; |
@@ -88,8 +88,7 @@ "use strict"; | ||
// message that is posted to the omnibar because all other messages will | ||
// be validated against the provided origin. If the origin provided here | ||
// be validated against the provided origin. If the origin of the host page | ||
// does not match a whilelist of allowed origins maintained by the omnibar, | ||
// further communications between the omnibar and host will be blocked. | ||
interop_1.BBAuthInterop.postOmnibarMessage(iframeEl, { | ||
messageType: 'host-ready', | ||
origin: location.origin | ||
messageType: 'host-ready' | ||
}); | ||
@@ -96,0 +95,0 @@ monkeyPatchState(); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
60312
1083
79