auth0-angular
Advanced tools
Comparing version 4.2.5 to 4.2.7
/** | ||
* Angular SDK to use with Auth0 | ||
* @version v4.2.5 - 2016-09-15 | ||
* @version v4.2.7 - 2016-10-31 | ||
* @link https://auth0.com | ||
@@ -103,3 +103,3 @@ * @author Martin Gontovnikas | ||
if (success || error) { | ||
args.push(authUtils.applied(callback)); | ||
args.push( (!success) ? authUtils.errorHandler(callback) : authUtils.applied(callback) ); | ||
} | ||
@@ -168,2 +168,22 @@ nodeback.apply(self, args); | ||
/* | ||
* | ||
* DESCRIPTION: Uses safeApply() on a callback after passing in the callback arguments | ||
* INPUT: function | ||
* OUTPUT: function | ||
* | ||
* */ | ||
authUtils.errorHandler = function(fn) { | ||
return function () { | ||
var args = Array.prototype.slice.call(arguments); | ||
if (args[0] !== null) { | ||
authUtils.safeApply(function () { | ||
fn.apply(null, args); | ||
}); | ||
} | ||
}; | ||
}; | ||
return authUtils; | ||
@@ -627,3 +647,3 @@ }]; | ||
var errorFn = !errorCallback ? null : function(err) { | ||
var errorFn = (!errorCallback && !getHandlers('loginFailure')) ? null : function(err) { | ||
callHandler('loginFailure', { error: err }); | ||
@@ -658,3 +678,3 @@ if (errorCallback) { | ||
var errorFn = !errorCallback ? null : function(err) { | ||
var errorFn = (!errorCallback && !getHandlers('loginFailure')) ? null : function(err) { | ||
callHandler('loginFailure', { error: err }); | ||
@@ -695,3 +715,3 @@ if (errorCallback) { | ||
var errorFn = !errorCallback ? null : function(err) { | ||
var errorFn = (!errorCallback && !getHandlers('loginFailure')) ? null : function(err) { | ||
callHandler('loginFailure', { error: err }); | ||
@@ -747,3 +767,3 @@ if (errorCallback) { | ||
var errorFn = function(err) { | ||
var errorFn = (!errorCallback && !getHandlers('loginFailure')) ? null : function(err) { | ||
if (errorCallback) { | ||
@@ -750,0 +770,0 @@ errorCallback(err); |
@@ -1,1 +0,1 @@ | ||
angular.module("auth0",["auth0.service","auth0.utils","auth0.directives"]).run(["auth",function(a){a.hookEvents()}]),angular.module("auth0.utils",[]).provider("authUtils",function(){var a={capitalize:function(a){return a?a.charAt(0).toUpperCase()+a.substring(1).toLowerCase():null},fnName:function(a){var b=a.toString();return b=b.substr("function ".length),b=b.substr(0,b.indexOf("(")),b?b.trim():b}};angular.extend(this,a),this.$get=["$rootScope","$q",function(b,c){var d={};return angular.extend(d,a),d.safeApply=function(a){var c=b.$root.$$phase;"$apply"===c||"$digest"===c?a&&"function"==typeof a&&a():b.$apply(a)},d.callbackify=function(a,b,c,e){return angular.isFunction(a)?function(f){f=Array.prototype.slice.call(arguments);var g=function(a,d,e){return a?void(c&&c(a)):(e=Array.prototype.slice.call(arguments,1),void(b&&b.apply(null,e)))};(b||c)&&f.push(d.applied(g)),a.apply(e,f)}:void 0},d.promisify=function(a,b){return angular.isFunction(a)?function(e){e=Array.prototype.slice.call(arguments);var f=c.defer(),g=function(a,b,c){return a?void f.reject(a):(c=Array.prototype.slice.call(arguments,1),void f.resolve(c.length>1?c:b))};return e.push(d.applied(g)),a.apply(b,e),f.promise.spread=f.promise.spread||function(a,b){return f.promise.then(function(b){return Array.isArray(b)?a.apply(null,b):a(b)},b)},f.promise}:void 0},d.applied=function(a){return function(b,c){b=b,c=c;var e=arguments;d.safeApply(function(){a.apply(null,e)})}},d}]}),angular.module("auth0.service",["auth0.utils"]).provider("auth",["authUtilsProvider",function(a){function b(a,b){b=b||f.lib;var c=g[b].library();return c[g[b][a]]}function c(a,b){return b=b||f.lib,g[b][a]}function d(b){if(b)return{lib:a.fnName(b),constructor:b};if(null!=window.Auth0Lock)return{lib:"Auth0Lock",constructor:window.Auth0Lock};if(null!=window.Auth0)return{lib:"Auth0",constructor:window.Auth0};if("undefined"!=typeof Auth0Widget)throw new Error("Auth0Widget is not supported with this version of auth0-angularanymore. Please try with an older one");throw new Error("Cannot initialize Auth0Angular. Auth0Lock or Auth0 must be available")}var e={callbackOnLocationHash:!0},f=this,g={Auth0:{signin:"login",signinOnly:"signinOnly",signup:"signup",reset:"changePassword",validateUser:"validateUser",library:function(){return f.auth0js},parseOptions:function(a){var b=angular.copy(a);return b.authParams&&(angular.extend(b,b.authParams),delete b.authParams),b}},Auth0Lock:{signin:"show",signinOnly:"showSignin",signup:"showSignup",reset:"showReset",library:function(){return f.auth0lib},parseOptions:function(a){return angular.copy(a)}}};this.init=function(a,b){if(!a)throw new Error("You must set options when calling init");this.loginUrl=a.loginUrl,this.loginUrlParams=a.loginUrlParams,this.loginState=a.loginState,this.loginStateParams=a.loginStateParams,this.clientID=a.clientID||a.clientId;var c=a.domain;this.domain=c,this.sso=a.sso;var f=d(b);this.lib=f.lib,"Auth0Lock"===f.lib?(this.auth0lib=new f.constructor(this.clientID,c,angular.extend(e,a)),this.auth0js=this.auth0lib.getClient(),this.isLock=!0):(this.auth0lib=new f.constructor(angular.extend(e,a)),this.auth0js=this.auth0lib,this.isLock=!1),this.initialized=!0},this.eventHandlers={},this.on=function(a,b){this.eventHandlers[a]||(this.eventHandlers[a]=[]),this.eventHandlers[a].push(b)};var h=["loginSuccess","loginFailure","logout","forbidden","authenticated"];angular.forEach(h,function(b){f["add"+a.capitalize(b)+"Handler"]=function(a){f.on(b,a)}}),this.$get=["$rootScope","$q","$injector","$window","$location","authUtils","$http",function(a,d,e,h,i,j,k){function l(){f.loginUrl?i.path(f.loginUrl,f.loginUrlParams):f.loginState?e.get("$state").go(f.loginState,f.loginStateParams):p("forbidden")}function m(a,b,c,d){n.isAuthenticated||n.refreshTokenPromise||(f.sso?(a&&b.preventDefault(),f.auth0js.getSSOData(j.applied(function(e,f){if(f.sso){var g={popup:!1,callbackOnLocationHash:!0,connection:f.lastUsedConnection.name,authParams:{state:c()}};p("ssoLogin",{loginOptions:g}),n.signin(g,null,null,"Auth0")}else a&&(b.preventDefault(),d())}))):a&&(b.preventDefault(),d()))}var n={isAuthenticated:!1};a.isAuthenticated=!1;var o=function(a){return f.eventHandlers[a]},p=function(b,c){a.$broadcast("auth0."+b,c),angular.forEach(o(b)||[],function(a){e.invoke(a,n,c)})},q=function(b,c,d,e,f,g){b=b||(f?f.idToken:null),c=c||(f?f.accessToken:null),d=d||(f?f.state:null),e=e||(f?f.refreshToken:null);var h=n.getProfile(b),i={idToken:b,accessToken:c,state:d,refreshToken:e,profile:f,isAuthenticated:!0};return a.isAuthenticated=!0,angular.extend(n,i),p(g?"authenticated":"loginSuccess",angular.extend({profilePromise:h},i)),h};a.$on("$locationChangeStart",function(){if(f.initialized){var a=f.auth0lib.parseHash(h.location.hash);return!n.isAuthenticated&&a&&(a.idToken||a.id_token)?void q(a.idToken||a.id_token,a.accessToken||a.access_token,a.state,a.refreshToken||a.refresh_token):void 0}}),a.$on("auth0.forbiddenRequest",function(){l()}),f.loginUrl&&a.$on("$routeChangeStart",function(a,b){f.initialized&&m(b.$$route&&b.$$route.requiresLogin,a,function(){return JSON.stringify({redirect_to:{path:i.path()}})},function(){i.path(f.loginUrl,f.loginUrlParams)})}),f.loginState&&a.$on("$stateChangeStart",function(a,b,c){f.initialized&&m(b.data&&b.data.requiresLogin,a,function(){return JSON.stringify({redirect_to:{state:b.name,params:c}})},function(){e.get("$state").go(f.loginState,f.loginStateParams)})}),n.config=f;var r=function(a,b){var c=o("loginSuccess");if(!(b||a.username||a.email||c&&0!==c.length))throw new Error("You must define a loginSuccess handler if not using popup mode or not doing ro call because that means you are doing a redirect")},s=function(a,b,c){var d=c.user_id;return k({method:"POST",url:"https://"+f.domain+"/api/v2/users/"+d+"/identities",headers:{Authorization:"Bearer "+a},data:{link_with:b}})},t=function(a,b,c,d){return k({method:"DELETE",url:"https://"+f.domain+"/api/v2/users/"+b+"/identities/"+c+"/"+d,headers:{Authorization:"Bearer "+a}})};return n.hookEvents=function(){},n.init=angular.bind(f,f.init),n.getToken=function(a){a=a||{scope:"openid"},a.id_token||a.refresh_token||(a.id_token=n.idToken);var b=j.promisify(f.auth0js.getDelegationToken,f.auth0js);return b(a)},n.refreshIdToken=function(a){var b=j.promisify(f.auth0js.refreshToken,f.auth0js);return n.refreshTokenPromise=b(a||n.refreshToken).then(function(a){return a.id_token})["finally"](function(){n.refreshTokenPromise=null}),n.refreshTokenPromise},n.renewIdToken=function(a){var b=j.promisify(f.auth0js.renewIdToken,f.auth0js);return b(a||n.idToken).then(function(a){return a.id_token})},n.signin=function(a,d,e,h){a=a||{},r(a,d,e),a=c("parseOptions",h)(a);var i=b("signin",h),k=d?function(b,c,e,f,g){c=c||b.idToken,e=e||b.accessToken,f=f||b.state,g=g||b.refreshToken,c||angular.isUndefined(a.loginAfterSignup)||a.loginAfterSignup?q(c,e,f,g,b).then(function(a){d&&d(a,c,e,f,g)}):d()}:null,l=e?function(a){p("loginFailure",{error:a}),e&&e(a)}:null,m=j.callbackify(i,k,l,g[h||f.lib].library());m(a)},n.signinOnly=function(a,d,e,h){a=a||{},r(a,d,e),a=c("parseOptions",h)(a);var i=b("signinOnly",h),k=d?function(b,c,e,f,g){c||angular.isUndefined(a.loginAfterSignup)||a.loginAfterSignup?q(c,e,f,g,b).then(function(a){d&&d(a,c,e,f,g)}):d()}:null,l=e?function(a){p("loginFailure",{error:a}),e&&e(a)}:null,m=j.callbackify(i,k,l,g[h||f.lib].library());m(a)},n.signup=function(a,d,e){a=a||{},r(a,d,e),a=c("parseOptions")(a);var g=d?function(b,c,e,f,g){angular.isUndefined(a.auto_login)||a.auto_login?q(c,e,f,g,b).then(function(a){d&&d(a,c,e,f,g)}):d()}:null,h=e?function(a){p("loginFailure",{error:a}),e&&e(a)}:null,i=f.auth0lib,k=j.callbackify(b("signup"),g,h,i);k(a)},n.linkAccount=function(a,d,e,h,i,k){var l={popup:!0};if(!a||!d)throw new Error("Available token and profile is needed to link to another");if(!e.connection)throw new Error("Connection type (eg: facebook, github) is required to link account");e=e||{},r(e,h,i),angular.extend(e,l),e=c("parseOptions",k)(e);var m=b("signin",k),n=function(b,c){s(a,c,d).then(function(a){h(a)},function(a){i(a)})},o=function(a){i&&i(a)},p=j.callbackify(m,n,o,g[k||f.lib].library());p(e)},n.unLinkAccount=function(a,b,c,d){if(!(a&&b&&c&&d))throw new Error("All the arguments are required to unlink. Please refer to documentation for the arguments");return t(a,b,c,d)},n.reset=function(a,d,e){a=a||{},a=c("parseOptions")(a);var g=f.auth0lib,h=j.callbackify(b("reset"),d,e,g);h(a)},n.validateUser=function(a,d,e){a=a||{},a=c("parseOptions")(a);var g=f.auth0lib,h=j.callbackify(b("validateUser"),d,e,g);h(a)},n.signout=function(){n.isAuthenticated=!1,n.profile=null,n.profilePromise=null,n.idToken=null,n.state=null,n.accessToken=null,n.tokenPayload=null,a.isAuthenticated=!1,p("logout")},n.authenticate=function(a,b,c,d,e){return q(b,c,d,e,a,!0)},n.getProfile=function(a){var b=j.promisify(f.auth0lib.getProfile,f.auth0lib);return n.profilePromise=b(a||n.idToken),n.profilePromise.then(function(a){return n.profile=a,a})},n.hide=function(a){f.auth0lib.hide(a)},n}]}]),angular.module("auth0.directives",["auth0.service"]),angular.module("auth0.directives").directive("ifUser",["$rootScope",function(a){return{link:function(b,c){a.$watch("isAuthenticated",function(a){a?c.removeClass("ng-hide"):c.addClass("ng-hide")})}}}]); | ||
angular.module("auth0",["auth0.service","auth0.utils","auth0.directives"]).run(["auth",function(a){a.hookEvents()}]),angular.module("auth0.utils",[]).provider("authUtils",function(){var a={capitalize:function(a){return a?a.charAt(0).toUpperCase()+a.substring(1).toLowerCase():null},fnName:function(a){var b=a.toString();return b=b.substr("function ".length),b=b.substr(0,b.indexOf("(")),b?b.trim():b}};angular.extend(this,a),this.$get=["$rootScope","$q",function(b,c){var d={};return angular.extend(d,a),d.safeApply=function(a){var c=b.$root.$$phase;"$apply"===c||"$digest"===c?a&&"function"==typeof a&&a():b.$apply(a)},d.callbackify=function(a,b,c,e){return angular.isFunction(a)?function(f){f=Array.prototype.slice.call(arguments);var g=function(a,d,e){return a?void(c&&c(a)):(e=Array.prototype.slice.call(arguments,1),void(b&&b.apply(null,e)))};(b||c)&&f.push(b?d.applied(g):d.errorHandler(g)),a.apply(e,f)}:void 0},d.promisify=function(a,b){return angular.isFunction(a)?function(e){e=Array.prototype.slice.call(arguments);var f=c.defer(),g=function(a,b,c){return a?void f.reject(a):(c=Array.prototype.slice.call(arguments,1),void f.resolve(c.length>1?c:b))};return e.push(d.applied(g)),a.apply(b,e),f.promise.spread=f.promise.spread||function(a,b){return f.promise.then(function(b){return Array.isArray(b)?a.apply(null,b):a(b)},b)},f.promise}:void 0},d.applied=function(a){return function(b,c){b=b,c=c;var e=arguments;d.safeApply(function(){a.apply(null,e)})}},d.errorHandler=function(a){return function(){var b=Array.prototype.slice.call(arguments);null!==b[0]&&d.safeApply(function(){a.apply(null,b)})}},d}]}),angular.module("auth0.service",["auth0.utils"]).provider("auth",["authUtilsProvider",function(a){function b(a,b){b=b||f.lib;var c=g[b].library();return c[g[b][a]]}function c(a,b){return b=b||f.lib,g[b][a]}function d(b){if(b)return{lib:a.fnName(b),constructor:b};if(null!=window.Auth0Lock)return{lib:"Auth0Lock",constructor:window.Auth0Lock};if(null!=window.Auth0)return{lib:"Auth0",constructor:window.Auth0};if("undefined"!=typeof Auth0Widget)throw new Error("Auth0Widget is not supported with this version of auth0-angularanymore. Please try with an older one");throw new Error("Cannot initialize Auth0Angular. Auth0Lock or Auth0 must be available")}var e={callbackOnLocationHash:!0},f=this,g={Auth0:{signin:"login",signinOnly:"signinOnly",signup:"signup",reset:"changePassword",validateUser:"validateUser",library:function(){return f.auth0js},parseOptions:function(a){var b=angular.copy(a);return b.authParams&&(angular.extend(b,b.authParams),delete b.authParams),b}},Auth0Lock:{signin:"show",signinOnly:"showSignin",signup:"showSignup",reset:"showReset",library:function(){return f.auth0lib},parseOptions:function(a){return angular.copy(a)}}};this.init=function(a,b){if(!a)throw new Error("You must set options when calling init");this.loginUrl=a.loginUrl,this.loginUrlParams=a.loginUrlParams,this.loginState=a.loginState,this.loginStateParams=a.loginStateParams,this.clientID=a.clientID||a.clientId;var c=a.domain;this.domain=c,this.sso=a.sso;var f=d(b);this.lib=f.lib,"Auth0Lock"===f.lib?(this.auth0lib=new f.constructor(this.clientID,c,angular.extend(e,a)),this.auth0js=this.auth0lib.getClient(),this.isLock=!0):(this.auth0lib=new f.constructor(angular.extend(e,a)),this.auth0js=this.auth0lib,this.isLock=!1),this.initialized=!0},this.eventHandlers={},this.on=function(a,b){this.eventHandlers[a]||(this.eventHandlers[a]=[]),this.eventHandlers[a].push(b)};var h=["loginSuccess","loginFailure","logout","forbidden","authenticated"];angular.forEach(h,function(b){f["add"+a.capitalize(b)+"Handler"]=function(a){f.on(b,a)}}),this.$get=["$rootScope","$q","$injector","$window","$location","authUtils","$http",function(a,d,e,h,i,j,k){function l(){f.loginUrl?i.path(f.loginUrl,f.loginUrlParams):f.loginState?e.get("$state").go(f.loginState,f.loginStateParams):p("forbidden")}function m(a,b,c,d){n.isAuthenticated||n.refreshTokenPromise||(f.sso?(a&&b.preventDefault(),f.auth0js.getSSOData(j.applied(function(e,f){if(f.sso){var g={popup:!1,callbackOnLocationHash:!0,connection:f.lastUsedConnection.name,authParams:{state:c()}};p("ssoLogin",{loginOptions:g}),n.signin(g,null,null,"Auth0")}else a&&(b.preventDefault(),d())}))):a&&(b.preventDefault(),d()))}var n={isAuthenticated:!1};a.isAuthenticated=!1;var o=function(a){return f.eventHandlers[a]},p=function(b,c){a.$broadcast("auth0."+b,c),angular.forEach(o(b)||[],function(a){e.invoke(a,n,c)})},q=function(b,c,d,e,f,g){b=b||(f?f.idToken:null),c=c||(f?f.accessToken:null),d=d||(f?f.state:null),e=e||(f?f.refreshToken:null);var h=n.getProfile(b),i={idToken:b,accessToken:c,state:d,refreshToken:e,profile:f,isAuthenticated:!0};return a.isAuthenticated=!0,angular.extend(n,i),p(g?"authenticated":"loginSuccess",angular.extend({profilePromise:h},i)),h};a.$on("$locationChangeStart",function(){if(f.initialized){var a=f.auth0lib.parseHash(h.location.hash);return!n.isAuthenticated&&a&&(a.idToken||a.id_token)?void q(a.idToken||a.id_token,a.accessToken||a.access_token,a.state,a.refreshToken||a.refresh_token):void 0}}),a.$on("auth0.forbiddenRequest",function(){l()}),f.loginUrl&&a.$on("$routeChangeStart",function(a,b){f.initialized&&m(b.$$route&&b.$$route.requiresLogin,a,function(){return JSON.stringify({redirect_to:{path:i.path()}})},function(){i.path(f.loginUrl,f.loginUrlParams)})}),f.loginState&&a.$on("$stateChangeStart",function(a,b,c){f.initialized&&m(b.data&&b.data.requiresLogin,a,function(){return JSON.stringify({redirect_to:{state:b.name,params:c}})},function(){e.get("$state").go(f.loginState,f.loginStateParams)})}),n.config=f;var r=function(a,b){var c=o("loginSuccess");if(!(b||a.username||a.email||c&&0!==c.length))throw new Error("You must define a loginSuccess handler if not using popup mode or not doing ro call because that means you are doing a redirect")},s=function(a,b,c){var d=c.user_id;return k({method:"POST",url:"https://"+f.domain+"/api/v2/users/"+d+"/identities",headers:{Authorization:"Bearer "+a},data:{link_with:b}})},t=function(a,b,c,d){return k({method:"DELETE",url:"https://"+f.domain+"/api/v2/users/"+b+"/identities/"+c+"/"+d,headers:{Authorization:"Bearer "+a}})};return n.hookEvents=function(){},n.init=angular.bind(f,f.init),n.getToken=function(a){a=a||{scope:"openid"},a.id_token||a.refresh_token||(a.id_token=n.idToken);var b=j.promisify(f.auth0js.getDelegationToken,f.auth0js);return b(a)},n.refreshIdToken=function(a){var b=j.promisify(f.auth0js.refreshToken,f.auth0js);return n.refreshTokenPromise=b(a||n.refreshToken).then(function(a){return a.id_token})["finally"](function(){n.refreshTokenPromise=null}),n.refreshTokenPromise},n.renewIdToken=function(a){var b=j.promisify(f.auth0js.renewIdToken,f.auth0js);return b(a||n.idToken).then(function(a){return a.id_token})},n.signin=function(a,d,e,h){a=a||{},r(a,d,e),a=c("parseOptions",h)(a);var i=b("signin",h),k=d?function(b,c,e,f,g){c=c||b.idToken,e=e||b.accessToken,f=f||b.state,g=g||b.refreshToken,c||angular.isUndefined(a.loginAfterSignup)||a.loginAfterSignup?q(c,e,f,g,b).then(function(a){d&&d(a,c,e,f,g)}):d()}:null,l=e||o("loginFailure")?function(a){p("loginFailure",{error:a}),e&&e(a)}:null,m=j.callbackify(i,k,l,g[h||f.lib].library());m(a)},n.signinOnly=function(a,d,e,h){a=a||{},r(a,d,e),a=c("parseOptions",h)(a);var i=b("signinOnly",h),k=d?function(b,c,e,f,g){c||angular.isUndefined(a.loginAfterSignup)||a.loginAfterSignup?q(c,e,f,g,b).then(function(a){d&&d(a,c,e,f,g)}):d()}:null,l=e||o("loginFailure")?function(a){p("loginFailure",{error:a}),e&&e(a)}:null,m=j.callbackify(i,k,l,g[h||f.lib].library());m(a)},n.signup=function(a,d,e){a=a||{},r(a,d,e),a=c("parseOptions")(a);var g=d?function(b,c,e,f,g){angular.isUndefined(a.auto_login)||a.auto_login?q(c,e,f,g,b).then(function(a){d&&d(a,c,e,f,g)}):d()}:null,h=e||o("loginFailure")?function(a){p("loginFailure",{error:a}),e&&e(a)}:null,i=f.auth0lib,k=j.callbackify(b("signup"),g,h,i);k(a)},n.linkAccount=function(a,d,e,h,i,k){var l={popup:!0};if(!a||!d)throw new Error("Available token and profile is needed to link to another");if(!e.connection)throw new Error("Connection type (eg: facebook, github) is required to link account");e=e||{},r(e,h,i),angular.extend(e,l),e=c("parseOptions",k)(e);var m=b("signin",k),n=function(b,c){s(a,c,d).then(function(a){h(a)},function(a){i(a)})},p=i||o("loginFailure")?function(a){i&&i(a)}:null,q=j.callbackify(m,n,p,g[k||f.lib].library());q(e)},n.unLinkAccount=function(a,b,c,d){if(!(a&&b&&c&&d))throw new Error("All the arguments are required to unlink. Please refer to documentation for the arguments");return t(a,b,c,d)},n.reset=function(a,d,e){a=a||{},a=c("parseOptions")(a);var g=f.auth0lib,h=j.callbackify(b("reset"),d,e,g);h(a)},n.validateUser=function(a,d,e){a=a||{},a=c("parseOptions")(a);var g=f.auth0lib,h=j.callbackify(b("validateUser"),d,e,g);h(a)},n.signout=function(){n.isAuthenticated=!1,n.profile=null,n.profilePromise=null,n.idToken=null,n.state=null,n.accessToken=null,n.tokenPayload=null,a.isAuthenticated=!1,p("logout")},n.authenticate=function(a,b,c,d,e){return q(b,c,d,e,a,!0)},n.getProfile=function(a){var b=j.promisify(f.auth0lib.getProfile,f.auth0lib);return n.profilePromise=b(a||n.idToken),n.profilePromise.then(function(a){return n.profile=a,a})},n.hide=function(a){f.auth0lib.hide(a)},n}]}]),angular.module("auth0.directives",["auth0.service"]),angular.module("auth0.directives").directive("ifUser",["$rootScope",function(a){return{link:function(b,c){a.$watch("isAuthenticated",function(a){a?c.removeClass("ng-hide"):c.addClass("ng-hide")})}}}]); |
@@ -0,1 +1,3 @@ | ||
# 4.2.7 | ||
* Fixed but for `loginFailure` event not catching errors | ||
@@ -2,0 +4,0 @@ # 4.0.X |
@@ -1,18 +0,3 @@ | ||
### Examples | ||
# Deprecation Notice | ||
**Note**: You can login with username: `hello@bye.com` and password: `hello` in all the examples listed below. | ||
The following examples offer a good starting point for including Auth0 in your AngularJS application: | ||
* [Custom Login](custom-login): Custom login form that uses Auth0 to authenticate. | ||
* [Custom Signup](custom-signup): Custom signup plus extra fields added to the user profile on creation. | ||
* [Widget](widget): A simple angular app doing auth with social and username/password using the Login Widget. | ||
* [API Authentication](widget-with-api): Call your protected API in the technology you want (Java, .NET, [Node.js](api-authentication/nodejs) using Auth0 generated tokens. | ||
Advanced scenarios: | ||
* [UI Router](ui-router): A full featured example of ui-router with auth0-angular. | ||
* [Widget + UI Router](ui-router): Similar to the UI Router example, but using the Login Widget instead of a custom login form. | ||
* [Delegation Token](delegation-token): Call two different APIs (with different client ids) from a single Angular App. | ||
* [RequireJS](requirejs): An example of how to integrate auth0-angular with RequireJS. | ||
* [Redirect Mode](redirect): An example of how to do redirect-based social authentication (instead of popup). | ||
* [Widget with Redirect Mode](widget-redirect): Example of Auth0Login Widget with redirect mode. | ||
These samples have been deprecated. Please see the new Auth0 + Angular samples [here](https://github.com/auth0-samples/auth0-angularjs-sample). |
@@ -6,3 +6,3 @@ { | ||
"author": "Martin Gontovnikas", | ||
"version": "4.2.5", | ||
"version": "4.2.7", | ||
"main": "index.js", | ||
@@ -9,0 +9,0 @@ "devDependencies": { |
@@ -5,3 +5,3 @@ # Auth0 and AngularJS | ||
**This SDK is for use with Lock v9. For use with Lock 10, see the [angular-lock](https://github.com/auth0/angular-auth0) and [angular-auth0](https://github.com/auth0/angular-lock) wrappers.** | ||
**This SDK is for use with Lock v9. For use with Lock 10, see the [angular-lock](https://github.com/auth0/angular-lock) and [angular-auth0](https://github.com/auth0/angular-auth0) wrappers.** | ||
@@ -39,3 +39,3 @@ --- | ||
<script type="text/javascript" src="//cdn.auth0.com/js/lock-9.0.js"></script> | ||
<script type="text/javascript" src="//cdn.auth0.com/w2/auth0-angular-4.2.5.js"></script> | ||
<script type="text/javascript" src="//cdn.auth0.com/w2/auth0-angular-4.2.6.js"></script> | ||
```` | ||
@@ -42,0 +42,0 @@ |
@@ -452,3 +452,3 @@ | ||
var errorFn = !errorCallback ? null : function(err) { | ||
var errorFn = (!errorCallback && !getHandlers('loginFailure')) ? null : function(err) { | ||
callHandler('loginFailure', { error: err }); | ||
@@ -483,3 +483,3 @@ if (errorCallback) { | ||
var errorFn = !errorCallback ? null : function(err) { | ||
var errorFn = (!errorCallback && !getHandlers('loginFailure')) ? null : function(err) { | ||
callHandler('loginFailure', { error: err }); | ||
@@ -520,3 +520,3 @@ if (errorCallback) { | ||
var errorFn = !errorCallback ? null : function(err) { | ||
var errorFn = (!errorCallback && !getHandlers('loginFailure')) ? null : function(err) { | ||
callHandler('loginFailure', { error: err }); | ||
@@ -572,3 +572,3 @@ if (errorCallback) { | ||
var errorFn = function(err) { | ||
var errorFn = (!errorCallback && !getHandlers('loginFailure')) ? null : function(err) { | ||
if (errorCallback) { | ||
@@ -575,0 +575,0 @@ errorCallback(err); |
@@ -89,3 +89,3 @@ /* | ||
if (success || error) { | ||
args.push(authUtils.applied(callback)); | ||
args.push( (!success) ? authUtils.errorHandler(callback) : authUtils.applied(callback) ); | ||
} | ||
@@ -154,2 +154,22 @@ nodeback.apply(self, args); | ||
/* | ||
* | ||
* DESCRIPTION: Uses safeApply() on a callback after passing in the callback arguments | ||
* INPUT: function | ||
* OUTPUT: function | ||
* | ||
* */ | ||
authUtils.errorHandler = function(fn) { | ||
return function () { | ||
var args = Array.prototype.slice.call(arguments); | ||
if (args[0] !== null) { | ||
authUtils.safeApply(function () { | ||
fn.apply(null, args); | ||
}); | ||
} | ||
}; | ||
}; | ||
return authUtils; | ||
@@ -156,0 +176,0 @@ }]; |
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
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
0
12
0
156994
30
2248