auth0-angular
Advanced tools
Comparing version 4.2.3 to 4.2.4
/** | ||
* Angular SDK to use with Auth0 | ||
* @version v4.2.3 - 2016-07-08 | ||
* @version v4.2.4 - 2016-09-14 | ||
* @link https://auth0.com | ||
@@ -156,6 +156,4 @@ * @author Martin Gontovnikas | ||
// Adding arguments just due to a bug in Auth0.js. | ||
return function (err, response) { | ||
return function () { | ||
// Using variables so that they don't get deleted by UglifyJS | ||
err = err; | ||
response = response; | ||
var argsCall = arguments; | ||
@@ -626,3 +624,3 @@ authUtils.safeApply(function() { | ||
var errorFn = !errorCallback ? null : function(err) { | ||
var errorFn = function(err) { | ||
callHandler('loginFailure', { error: err }); | ||
@@ -629,0 +627,0 @@ if (errorCallback) { |
@@ -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(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(){var b=arguments;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=function(a){p("loginFailure",{error:a}),e&&e(a)},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")})}}}]); |
@@ -1,9 +0,3 @@ | ||
angular.module( 'sample', [ | ||
'auth0', | ||
'ngRoute', | ||
'sample.home', | ||
'angular-storage', | ||
'angular-jwt' | ||
]) | ||
.config( function myAppConfig ( $routeProvider, authProvider, $httpProvider, $locationProvider, | ||
var app = angular.module('sample', ['auth0', 'angular-storage', 'angular-jwt', 'ngRoute', 'sample.home']); | ||
app.config( function myAppConfig ( $routeProvider, authProvider, $httpProvider, $locationProvider, | ||
jwtInterceptorProvider) { | ||
@@ -30,2 +24,3 @@ $routeProvider | ||
//Called when login is successful | ||
authProvider.on('loginSuccess', function($location, profilePromise, idToken, store) { | ||
@@ -57,3 +52,8 @@ console.log("Login Success"); | ||
$httpProvider.interceptors.push('jwtInterceptor'); | ||
}).run(function($rootScope, auth, store, jwtHelper, $location) { | ||
}); | ||
app.run(['auth', function(auth) { | ||
// This hooks all auth events to check everything as soon as the app starts | ||
auth.hookEvents(); | ||
}]); | ||
app.run(function($rootScope, auth, store, jwtHelper, $location) { | ||
$rootScope.$on('$locationChangeStart', function() { | ||
@@ -65,2 +65,3 @@ | ||
if (!auth.isAuthenticated) { | ||
//Re-authenticate user if token is valid | ||
auth.authenticate(store.get('profile'), token); | ||
@@ -73,6 +74,5 @@ } | ||
} | ||
}); | ||
}) | ||
.controller( 'AppCtrl', function AppCtrl ( $scope, $location ) { | ||
}); | ||
app.controller( 'AppCtrl', function AppCtrl ( $scope, $location ) { | ||
$scope.$on('$routeChangeSuccess', function(e, nextRoute){ | ||
@@ -79,0 +79,0 @@ if ( nextRoute.$$route && angular.isDefined( nextRoute.$$route.pageTitle ) ) { |
@@ -1,3 +0,2 @@ | ||
angular.module( 'sample') | ||
.controller( 'LoginCtrl', function ( $scope, auth, $rootScope) { | ||
app.controller( 'LoginCtrl', function ( $scope, auth) { | ||
@@ -4,0 +3,0 @@ $scope.auth = auth; |
@@ -6,3 +6,3 @@ { | ||
"author": "Martin Gontovnikas", | ||
"version": "4.2.3", | ||
"version": "4.2.4", | ||
"main": "index.js", | ||
@@ -9,0 +9,0 @@ "devDependencies": { |
# Auth0 and AngularJS | ||
## Deprecation Notice | ||
**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 AngularJS module will help you implement client-side and server-side (API) authentication. It can be used together with [Auth0](https://www.auth0.com) to add support for username/password authentication, enterprise identity providers like Active Directory or SAML and also for social identity providers like Google, Facebook or Salesforce among others to your web, API and native mobile apps. | ||
@@ -4,0 +10,0 @@ |
@@ -452,3 +452,3 @@ | ||
var errorFn = !errorCallback ? null : function(err) { | ||
var errorFn = function(err) { | ||
callHandler('loginFailure', { error: err }); | ||
@@ -455,0 +455,0 @@ if (errorCallback) { |
@@ -142,6 +142,4 @@ /* | ||
// Adding arguments just due to a bug in Auth0.js. | ||
return function (err, response) { | ||
return function () { | ||
// Using variables so that they don't get deleted by UglifyJS | ||
err = err; | ||
response = response; | ||
var argsCall = arguments; | ||
@@ -148,0 +146,0 @@ authUtils.safeApply(function() { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
349515
166
4463
468
3