authentication-adal-pkg
Advanced tools
Comparing version 1.0.18 to 1.0.19
@@ -301,4 +301,8 @@ 'use strict'; | ||
}; | ||
var authenticateMobile = function authenticateMobile(resolve, reject) { | ||
var storeToken = function(token, exp) { | ||
storage.set(constants.IN_PROGRESS, false); | ||
storage.set(constants.TOKEN, token); | ||
storage.set(constants.TOKEN_EXPIRATION, exp); | ||
}; | ||
var authenticateMobile = function(resolve, reject) { | ||
// Check if MS ADAL cordova library is installed | ||
@@ -321,5 +325,3 @@ Microsoft.ADAL.AuthenticationSettings.setUseBroker(true).then(function() { | ||
var exp = new Date(authResult.expiresOn).getTime(); | ||
storage.set(constants.IN_PROGRESS, false); | ||
storage.set(constants.TOKEN, token); | ||
storage.set(constants.TOKEN_EXPIRATION, exp); | ||
storeToken(token, exp); | ||
resolve(authResult); | ||
@@ -329,3 +331,11 @@ }, | ||
// We require user credentials so triggers authentication dialog | ||
acquireTokenAsyncMobile(resolve, reject); | ||
// acquireTokenAsyncMobile(resolve, reject); | ||
authContext | ||
.acquireTokenAsync(resourceUri, clientId, platformRedirectUri) | ||
.then(function(authResult) { | ||
var token = authResult.idToken; | ||
var exp = new Date(authResult.expiresOn).getTime(); | ||
storeToken(token, exp); | ||
resolve(authResult); | ||
}, reject); | ||
} | ||
@@ -332,0 +342,0 @@ ); |
@@ -288,3 +288,3 @@ 'use strict'; | ||
var acquireTokenAsyncMobile = function(rosolve, reject) { | ||
var acquireTokenAsyncMobile = function(resolve, reject) { | ||
authContext | ||
@@ -328,4 +328,3 @@ .acquireTokenAsync(resourceUri, clientId, platformRedirectUri) | ||
} else { | ||
// When token has expired, acquire new token | ||
acquireTokenAsyncMobile(resolve, reject); | ||
acquireTokenAsyncMobile(rosolve, reject); | ||
} | ||
@@ -335,3 +334,13 @@ }, | ||
// We require user credentials so triggers authentication dialog | ||
acquireTokenAsyncMobile(resolve, reject); | ||
authContext | ||
.acquireTokenAsync(resourceUri, clientId, platformRedirectUri) | ||
.then(function(authResult) { | ||
var idToken = authResult.idToken; | ||
var _decodeTokenPayload3 = decodeTokenPayload(idToken); | ||
var exp = _decodeTokenPayload3.exp; | ||
storage.set(constants.IN_PROGRESS, false); | ||
storage.set(constants.TOKEN, idToken); | ||
storage.set(constants.TOKEN_EXPIRATION, exp); | ||
resolve(authResult); | ||
}, reject); | ||
} | ||
@@ -338,0 +347,0 @@ ); |
{ | ||
"name": "authentication-adal-pkg", | ||
"version": "1.0.18", | ||
"version": "1.0.19", | ||
"description": "An authentication SDK based on MS ADAL ", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
67046
2015