Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

auth0-angular

Package Overview
Dependencies
Maintainers
5
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

auth0-angular - npm Package Compare versions

Comparing version 4.1.0 to 4.2.0

examples/sso/views/secure.html

10

bower.json

@@ -6,12 +6,12 @@ {

"angular": "*",
"auth0.js": ">= 5.2.2",
"auth0-lock": ">= 6.3.0"
"auth0-lock": ">= 6.3.0",
"auth0.js": ">= 5.2.2"
},
"devDependencies": {
"angular-mocks": "~1.3.0",
"angular-route": "~1.3.0"
"angular-mocks": "~1.5.5",
"angular-route": "~1.5.5"
},
"resolutions": {
"angular": "1.3.0"
"angular": "1.5.5"
}
}
/**
* Angular SDK to use with Auth0
* @version v4.0.5 - 2015-12-21
* @version v4.2.0 - 2016-05-31
* @link https://auth0.com

@@ -8,433 +8,811 @@ * @author Martin Gontovnikas

*/
(function () {
angular.module('auth0', [
'auth0.service',
'auth0.utils'
]).run([
'auth',
function (auth) {
auth.hookEvents();
}
]);
angular.module('auth0.utils', []).provider('authUtils', function () {
var Utils = {
capitalize: function (string) {
return string ? string.charAt(0).toUpperCase() + string.substring(1).toLowerCase() : null;
},
fnName: function (fun) {
var ret = fun.toString();
ret = ret.substr('function '.length);
ret = ret.substr(0, ret.indexOf('('));
return ret ? ret.trim() : ret;
}
};
angular.extend(this, Utils);
this.$get = [
'$rootScope',
'$q',
function ($rootScope, $q) {
var authUtils = {};
angular.extend(authUtils, Utils);
authUtils.safeApply = function (fn) {
var phase = $rootScope.$root.$$phase;
if (phase === '$apply' || phase === '$digest') {
if (fn && typeof fn === 'function') {
fn();
}
} else {
$rootScope.$apply(fn);
}
};
authUtils.callbackify = function (nodeback, success, error, self) {
if (angular.isFunction(nodeback)) {
return function (args) {
args = Array.prototype.slice.call(arguments);
var callback = function (err, response, etc) {
if (err) {
error && error(err);
return;
angular.module('auth0', ['auth0.service', 'auth0.utils', 'auth0.directives'])
.run(["auth", function(auth) {
auth.hookEvents();
}]);
/*
*
* Utility service to assist with:
* 1. Capitalization
* 2. Retrieve function name
* 3. Angular's $rootScope.$apply
* 4. Creates an 'applied' callback
* 5. Convert callbacks to promises
*
* */
angular.module('auth0.utils', [])
.provider('authUtils', function() {
var Utils = {
/*
*
* DESCRIPTION: Capitalize strings
* INPUT: string
* OUTPUT: string
*
* */
capitalize: function(string) {
return string ? string.charAt(0).toUpperCase() + string.substring(1).toLowerCase() : null;
},
/*
*
* DESCRIPTION: Retrieve the name of a supplied function
* INPUT: function
* OUTPUT: string
*
* */
fnName : function(fun) {
var ret = fun.toString();
ret = ret.substr('function '.length);
ret = ret.substr(0, ret.indexOf('('));
return ret ? ret.trim() : ret;
}
// if more arguments then turn into an array for .spread()
etc = Array.prototype.slice.call(arguments, 1);
success && success.apply(null, etc);
};
if (success || error) {
args.push(authUtils.applied(callback));
}
nodeback.apply(self, args);
};
}
};
authUtils.promisify = function (nodeback, self) {
if (angular.isFunction(nodeback)) {
return function (args) {
args = Array.prototype.slice.call(arguments);
var dfd = $q.defer();
var callback = function (err, response, etc) {
if (err) {
dfd.reject(err);
return;
angular.extend(this, Utils);
this.$get = ["$rootScope", "$q", function($rootScope, $q) {
var authUtils = {};
angular.extend(authUtils, Utils);
/*
*
* DESCRIPTION: Checks if Angular is in the $apply or $digest phase
* before calling $rootScope.$apply on a fn passed to it
*
* INPUT: function
*
* */
authUtils.safeApply = function(fn) {
var phase = $rootScope.$root.$$phase;
if(phase === '$apply' || phase === '$digest') {
if(fn && (typeof(fn) === 'function')) {
fn();
}
} else {
$rootScope.$apply(fn);
}
};
/*
*
* DESCRIPTION: Creates an 'applied callback using Angular's $apply()
* INPUT: function
* OUTPUT: function
*
* */
authUtils.callbackify = function (nodeback, success, error, self) {
if (angular.isFunction(nodeback)) {
return function (args) {
args = Array.prototype.slice.call(arguments);
var callback = function (err, response, etc) {
if (err) {
error && error(err);
return;
}
// if more arguments then turn into an array for .spread()
etc = Array.prototype.slice.call(arguments, 1);
success && success.apply(null, etc);
};
if (success || error) {
args.push(authUtils.applied(callback));
}
nodeback.apply(self, args);
};
}
};
/*
*
* DESCRIPTION: Creates a promise from where a callback is expected
* INPUT: function
* OUTPUT: function
*
* */
authUtils.promisify = function (nodeback, self) {
if (angular.isFunction(nodeback)) {
return function (args) {
args = Array.prototype.slice.call(arguments);
var dfd = $q.defer();
var callback = function (err, response, etc) {
if (err) {
dfd.reject(err);
return;
}
// if more arguments then turn into an array for .spread()
etc = Array.prototype.slice.call(arguments, 1);
dfd.resolve(etc.length > 1 ? etc : response);
};
args.push(authUtils.applied(callback));
nodeback.apply(self, args);
// spread polyfill only for promisify
dfd.promise.spread = dfd.promise.spread || function (fulfilled, rejected) {
return dfd.promise.then(function (array) {
return Array.isArray(array) ? fulfilled.apply(null, array) : fulfilled(array);
}, rejected);
};
return dfd.promise;
};
}
};
/*
*
* DESCRIPTION: Uses safeApply() on a callback after passing in the callback arguments
* INPUT: function
* OUTPUT: function
*
* */
authUtils.applied = function(fn) {
// Adding arguments just due to a bug in Auth0.js.
return function (err, response) {
// Using variables so that they don't get deleted by UglifyJS
err = err;
response = response;
var argsCall = arguments;
authUtils.safeApply(function() {
fn.apply(null, argsCall);
});
};
};
return authUtils;
}];
});
angular.module('auth0.service', ['auth0.utils'])
.provider('auth', ["authUtilsProvider", function(authUtilsProvider) {
var defaultOptions = {
callbackOnLocationHash: true
};
var config = this;
var innerAuth0libraryConfiguration = {
'Auth0': {
signin: 'login',
signup: 'signup',
reset: 'changePassword',
validateUser: 'validateUser',
library: function() {
return config.auth0js;
},
parseOptions: function(options) {
var retOptions = angular.copy(options);
if (retOptions.authParams) {
angular.extend(retOptions, retOptions.authParams);
delete retOptions.authParams;
}
return retOptions;
}
},
'Auth0Lock': {
signin: 'show',
signup: 'showSignup',
reset: 'showReset',
library: function() {
return config.auth0lib;
},
parseOptions: function(options) {
return angular.copy(options);
}
}
// if more arguments then turn into an array for .spread()
etc = Array.prototype.slice.call(arguments, 1);
dfd.resolve(etc.length > 1 ? etc : response);
};
args.push(authUtils.applied(callback));
nodeback.apply(self, args);
// spread polyfill only for promisify
dfd.promise.spread = dfd.promise.spread || function (fulfilled, rejected) {
return dfd.promise.then(function (array) {
return Array.isArray(array) ? fulfilled.apply(null, array) : fulfilled(array);
}, rejected);
};
return dfd.promise;
};
}
};
authUtils.applied = function (fn) {
// Adding arguments just due to a bug in Auth0.js.
return function (err, response) {
// Using variables so that they don't get deleted by UglifyJS
err = err;
response = response;
var argsCall = arguments;
authUtils.safeApply(function () {
fn.apply(null, argsCall);
});
};
};
return authUtils;
}
];
});
angular.module('auth0.service', ['auth0.utils']).provider('auth', [
'authUtilsProvider',
function (authUtilsProvider) {
var defaultOptions = { callbackOnLocationHash: true };
var config = this;
var innerAuth0libraryConfiguration = {
'Auth0': {
signin: 'login',
signup: 'signup',
reset: 'changePassword',
validateUser: 'validateUser',
library: function () {
return config.auth0js;
},
parseOptions: function (options) {
var retOptions = angular.copy(options);
if (retOptions.authParams) {
angular.extend(retOptions, retOptions.authParams);
delete retOptions.authParams;
}
return retOptions;
/*
*
* DESCRIPTION: Get a method from the libraries
*
* INPUT: method name (string), library name (string)
* OUTPUT: String
*
* */
function getInnerLibraryMethod(name, libName) {
libName = libName || config.lib;
var library = innerAuth0libraryConfiguration[libName].library();
return library[innerAuth0libraryConfiguration[libName][name]];
}
},
'Auth0Lock': {
signin: 'show',
signup: 'showSignup',
reset: 'showReset',
library: function () {
return config.auth0lib;
},
parseOptions: function (options) {
return angular.copy(options);
/*
*
* DESCRIPTION: Get a config from the libraries
*
* INPUT: config name (string), library name (string)
* OUTPUT: String
*
* */
function getInnerLibraryConfigField(name, libName) {
libName = libName || config.lib;
return innerAuth0libraryConfiguration[libName][name];
}
}
};
function getInnerLibraryMethod(name, libName) {
libName = libName || config.lib;
var library = innerAuth0libraryConfiguration[libName].library();
return library[innerAuth0libraryConfiguration[libName][name]];
}
function getInnerLibraryConfigField(name, libName) {
libName = libName || config.lib;
return innerAuth0libraryConfiguration[libName][name];
}
function constructorName(fun) {
if (fun) {
return {
lib: authUtilsProvider.fnName(fun),
constructor: fun
};
}
/* jshint ignore:start */
if (null != window.Auth0Lock) {
return {
lib: 'Auth0Lock',
constructor: window.Auth0Lock
};
}
if (null != window.Auth0) {
return {
lib: 'Auth0',
constructor: window.Auth0
};
}
if (null != Auth0Widget) {
throw new Error('Auth0Widget is not supported with this version of auth0-angular' + 'anymore. Please try with an older one');
}
throw new Error('Cannott initialize Auth0Angular. Auth0Lock or Auth0 must be available'); /* jshint ignore:end */
}
this.init = function (options, Auth0Constructor) {
if (!options) {
throw new Error('You must set options when calling init');
}
this.loginUrl = options.loginUrl;
this.loginState = options.loginState;
this.clientID = options.clientID || options.clientId;
var domain = options.domain;
this.sso = options.sso;
var constructorInfo = constructorName(Auth0Constructor);
this.lib = constructorInfo.lib;
if (constructorInfo.lib === 'Auth0Lock') {
this.auth0lib = new constructorInfo.constructor(this.clientID, domain, angular.extend(defaultOptions, options));
this.auth0js = this.auth0lib.getClient();
this.isLock = true;
} else {
this.auth0lib = new constructorInfo.constructor(angular.extend(defaultOptions, options));
this.auth0js = this.auth0lib;
this.isLock = false;
}
this.initialized = true;
};
this.eventHandlers = {};
this.on = function (anEvent, handler) {
if (!this.eventHandlers[anEvent]) {
this.eventHandlers[anEvent] = [];
}
this.eventHandlers[anEvent].push(handler);
};
var events = [
'loginSuccess',
'loginFailure',
'logout',
'forbidden',
'authenticated'
];
angular.forEach(events, function (anEvent) {
config['add' + authUtilsProvider.capitalize(anEvent) + 'Handler'] = function (handler) {
config.on(anEvent, handler);
};
});
this.$get = [
'$rootScope',
'$q',
'$injector',
'$window',
'$location',
'authUtils',
function ($rootScope, $q, $injector, $window, $location, authUtils) {
var auth = { isAuthenticated: false };
var getHandlers = function (anEvent) {
return config.eventHandlers[anEvent];
};
var callHandler = function (anEvent, locals) {
$rootScope.$broadcast('auth0.' + anEvent, locals);
angular.forEach(getHandlers(anEvent) || [], function (handler) {
$injector.invoke(handler, auth, locals);
});
};
// SignIn
var onSigninOk = function (idToken, accessToken, state, refreshToken, profile, isRefresh) {
var profilePromise = auth.getProfile(idToken);
var response = {
idToken: idToken,
accessToken: accessToken,
state: state,
refreshToken: refreshToken,
profile: profile,
isAuthenticated: true
};
angular.extend(auth, response);
callHandler(!isRefresh ? 'loginSuccess' : 'authenticated', angular.extend({ profilePromise: profilePromise }, response));
return profilePromise;
};
function forbidden() {
if (config.loginUrl) {
$location.path(config.loginUrl);
} else if (config.loginState) {
$injector.get('$state').go(config.loginState);
} else {
callHandler('forbidden');
/*
*
* DESCRIPTION: Returns a constructor: Defaults to a function if provided.
* Defaults to a Lock if library is included and function is not provided
*
* INPUT: function
* OUTPUT: object
*
* */
function constructorName(fun) {
if (fun) {
return {
lib: authUtilsProvider.fnName(fun),
constructor: fun
};
}
/* jshint ignore:start */
if (null != window.Auth0Lock) {
return {
lib: 'Auth0Lock',
constructor: window.Auth0Lock
};
}
if (null != window.Auth0) {
return {
lib: 'Auth0',
constructor: window.Auth0
};
}
if (typeof Auth0Widget !== 'undefined') {
throw new Error('Auth0Widget is not supported with this version of auth0-angular' +
'anymore. Please try with an older one');
}
throw new Error('Cannot initialize Auth0Angular. Auth0Lock or Auth0 must be available');
/* jshint ignore:end */
}
}
// Redirect mode
$rootScope.$on('$locationChangeStart', function () {
if (!config.initialized) {
return;
}
var hashResult = config.auth0lib.parseHash($window.location.hash);
if (!auth.isAuthenticated) {
if (hashResult && hashResult.id_token) {
onSigninOk(hashResult.id_token, hashResult.access_token, hashResult.state, hashResult.refresh_token);
return;
}
if (config.sso) {
config.auth0js.getSSOData(authUtils.applied(function (err, ssoData) {
if (ssoData.sso) {
var loginOptions = {
popup: false,
callbackOnLocationHash: true,
connection: ssoData.lastUsedConnection.name
};
callHandler('ssoLogin', { loginOptions: loginOptions });
auth.signin(loginOptions, null, null, 'Auth0');
}
}));
}
}
});
$rootScope.$on('auth0.forbiddenRequest', function () {
forbidden();
});
if (config.loginUrl) {
$rootScope.$on('$routeChangeStart', function (e, nextRoute) {
if (!config.initialized) {
return;
}
if (nextRoute.$$route && nextRoute.$$route.requiresLogin) {
if (!auth.isAuthenticated && !auth.refreshTokenPromise) {
$location.path(config.loginUrl);
/*
*
* DESCRIPTION: Configures provider with provided options
*
* INPUT: option (object) and constructor
*
* */
this.init = function(options, Auth0Constructor) {
if (!options) {
throw new Error('You must set options when calling init');
}
}
});
}
if (config.loginState) {
$rootScope.$on('$stateChangeStart', function (e, to) {
if (!config.initialized) {
return;
}
if (to.data && to.data.requiresLogin) {
if (!auth.isAuthenticated && !auth.refreshTokenPromise) {
e.preventDefault();
$injector.get('$state').go(config.loginState);
this.loginUrl = options.loginUrl;
this.loginState = options.loginState;
this.clientID = options.clientID || options.clientId;
var domain = options.domain;
this.domain = domain;
this.sso = options.sso;
var constructorInfo = constructorName(Auth0Constructor);
this.lib = constructorInfo.lib;
if (constructorInfo.lib === 'Auth0Lock') {
this.auth0lib = new constructorInfo.constructor(this.clientID, domain, angular.extend(defaultOptions, options));
this.auth0js = this.auth0lib.getClient();
this.isLock = true;
} else {
this.auth0lib = new constructorInfo.constructor(angular.extend(defaultOptions, options));
this.auth0js = this.auth0lib;
this.isLock = false;
}
}
this.initialized = true;
};
this.eventHandlers = {};
this.on = function(anEvent, handler) {
if (!this.eventHandlers[anEvent]) {
this.eventHandlers[anEvent] = [];
}
this.eventHandlers[anEvent].push(handler);
};
var events = ['loginSuccess', 'loginFailure', 'logout', 'forbidden', 'authenticated'];
angular.forEach(events, function(anEvent) {
config['add' + authUtilsProvider.capitalize(anEvent) + 'Handler'] = function(handler) {
config.on(anEvent, handler);
};
});
}
// Start auth service
auth.config = config;
var checkHandlers = function (options, successCallback) {
var successHandlers = getHandlers('loginSuccess');
if (!successCallback && !options.username && !options.email && (!successHandlers || successHandlers.length === 0)) {
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');
}
};
auth.hookEvents = function () {
};
auth.init = angular.bind(config, config.init);
auth.getToken = function (options) {
options = options || { scope: 'openid' };
if (!options.id_token && !options.refresh_token) {
options.id_token = auth.idToken;
}
var getDelegationTokenAsync = authUtils.promisify(config.auth0js.getDelegationToken, config.auth0js);
return getDelegationTokenAsync(options);
};
auth.refreshIdToken = function (refresh_token) {
var refreshTokenAsync = authUtils.promisify(config.auth0js.refreshToken, config.auth0js);
auth.refreshTokenPromise = refreshTokenAsync(refresh_token || auth.refreshToken).then(function (delegationResult) {
return delegationResult.id_token;
})['finally'](function () {
auth.refreshTokenPromise = null;
});
return auth.refreshTokenPromise;
};
auth.renewIdToken = function (id_token) {
var renewIdTokenAsync = authUtils.promisify(config.auth0js.renewIdToken, config.auth0js);
return renewIdTokenAsync(id_token || auth.idToken).then(function (delegationResult) {
return delegationResult.id_token;
});
};
auth.signin = function (options, successCallback, errorCallback, libName) {
options = options || {};
checkHandlers(options, successCallback, errorCallback);
options = getInnerLibraryConfigField('parseOptions', libName)(options);
var signinMethod = getInnerLibraryMethod('signin', libName);
var successFn = !successCallback ? null : function (profile, idToken, accessToken, state, refreshToken) {
if (!idToken && !angular.isUndefined(options.loginAfterSignup) && !options.loginAfterSignup) {
successCallback();
} else {
onSigninOk(idToken, accessToken, state, refreshToken, profile).then(function (profile) {
if (successCallback) {
successCallback(profile, idToken, accessToken, state, refreshToken);
this.$get = ["$rootScope", "$q", "$injector", "$window", "$location", "authUtils", "$http",
function($rootScope, $q, $injector, $window, $location, authUtils, $http) {
var auth = {
isAuthenticated: false
};
$rootScope.isAuthenticated = false;
var getHandlers = function(anEvent) {
return config.eventHandlers[anEvent];
};
var callHandler = function(anEvent, locals) {
$rootScope.$broadcast('auth0.' + anEvent, locals);
angular.forEach(getHandlers(anEvent) || [], function(handler) {
$injector.invoke(handler, auth, locals);
});
};
// SignIn
var onSigninOk = function(idToken, accessToken, state, refreshToken, profile, isRefresh) {
var profilePromise = auth.getProfile(idToken);
var response = {
idToken: idToken,
accessToken: accessToken,
state: state,
refreshToken: refreshToken,
profile: profile,
isAuthenticated: true
};
$rootScope.isAuthenticated = true;
angular.extend(auth, response);
callHandler(!isRefresh ? 'loginSuccess' : 'authenticated', angular.extend({
profilePromise: profilePromise
}, response));
return profilePromise;
};
function forbidden() {
if (config.loginUrl) {
$location.path(config.loginUrl);
} else if (config.loginState) {
$injector.get('$state').go(config.loginState);
} else {
callHandler('forbidden');
}
});
}
};
var errorFn = !errorCallback ? null : function (err) {
callHandler('loginFailure', { error: err });
if (errorCallback) {
errorCallback(err);
// Redirect mode
$rootScope.$on('$locationChangeStart', function() {
if (!config.initialized) {
return;
}
var hashResult = config.auth0lib.parseHash($window.location.hash);
if (!auth.isAuthenticated) {
if (hashResult && (hashResult.idToken || hashResult.id_token)) {
onSigninOk(hashResult.idToken || hashResult.id_token, hashResult.accessToken || hashResult.access_token, hashResult.state, hashResult.refreshToken || hashResult.refresh_token);
return;
}
}
});
$rootScope.$on('auth0.forbiddenRequest', function() {
forbidden();
});
if (config.loginUrl) {
$rootScope.$on('$routeChangeStart', function(e, nextRoute) {
if (!config.initialized) {
return;
}
verifyRoute(
(nextRoute.$$route && nextRoute.$$route.requiresLogin),
e,
function(){
return JSON.stringify({
redirect_to: {
path: $location.path()
}
});
},
function(){
$location.path(config.loginUrl);
}
);
});
}
};
var signinCall = authUtils.callbackify(signinMethod, successFn, errorFn, innerAuth0libraryConfiguration[libName || config.lib].library());
signinCall(options);
};
auth.signup = function (options, successCallback, errorCallback) {
options = options || {};
checkHandlers(options, successCallback, errorCallback);
options = getInnerLibraryConfigField('parseOptions')(options);
var successFn = !successCallback ? null : function (profile, idToken, accessToken, state, refreshToken) {
if (!angular.isUndefined(options.auto_login) && !options.auto_login) {
successCallback();
} else {
onSigninOk(idToken, accessToken, state, refreshToken, profile).then(function (profile) {
if (successCallback) {
successCallback(profile, idToken, accessToken, state, refreshToken);
if (config.loginState) {
$rootScope.$on('$stateChangeStart', function(e, to, toParams) {
if (!config.initialized) {
return;
}
verifyRoute(
(to.data && to.data.requiresLogin),
e,
function() {
return JSON.stringify({
redirect_to: {
state: to.name,
params: toParams
}
});
},
function() {
$injector.get('$state').go(config.loginState);
}
);
});
}
function verifyRoute(requiresLogin, e, getState, redirectToLogin) {
if (!auth.isAuthenticated && !auth.refreshTokenPromise) {
if (config.sso) {
if (requiresLogin) {e.preventDefault();}
config.auth0js.getSSOData(authUtils.applied(function(err, ssoData) {
if (ssoData.sso) {
var loginOptions = {
popup: false,
callbackOnLocationHash: true,
connection: ssoData.lastUsedConnection.name,
authParams: {
state: getState()
}
};
callHandler('ssoLogin', { loginOptions: loginOptions });
auth.signin(loginOptions, null, null, 'Auth0');
} else if (requiresLogin) {
e.preventDefault();
redirectToLogin();
}
}));
} else if (requiresLogin) {
e.preventDefault();
redirectToLogin();
}
}
});
}
};
var errorFn = !errorCallback ? null : function (err) {
callHandler('loginFailure', { error: err });
if (errorCallback) {
errorCallback(err);
// Start auth service
auth.config = config;
var checkHandlers = function(options, successCallback) {
var successHandlers = getHandlers('loginSuccess');
if (!successCallback && !options.username && !options.email && (!successHandlers || successHandlers.length === 0)) {
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');
}
};
var linkAccount = function(primaryJWT, secondaryJWT, profile){
var user_id = profile.user_id;
return $http(
{
method: 'POST',
url: 'https://' + config.domain + '/api/v2/users/' + user_id + '/identities',
headers: {
Authorization: 'Bearer ' + primaryJWT
},
data:{
link_with: secondaryJWT
}
}
)
}
};
var auth0lib = config.auth0lib;
var signupCall = authUtils.callbackify(getInnerLibraryMethod('signup'), successFn, errorFn, auth0lib);
signupCall(options);
};
auth.reset = function (options, successCallback, errorCallback) {
options = options || {};
options = getInnerLibraryConfigField('parseOptions')(options);
var auth0lib = config.auth0lib;
var resetCall = authUtils.callbackify(getInnerLibraryMethod('reset'), successCallback, errorCallback, auth0lib);
resetCall(options);
};
auth.validateUser = function (options, successCallback, errorCallback) {
options = options || {};
options = getInnerLibraryConfigField('parseOptions')(options);
var auth0lib = config.auth0lib;
var validateUserCall = authUtils.callbackify(getInnerLibraryMethod('validateUser'), successCallback, errorCallback, auth0lib);
validateUserCall(options);
};
auth.signout = function () {
auth.isAuthenticated = false;
auth.profile = null;
auth.profilePromise = null;
auth.idToken = null;
auth.state = null;
auth.accessToken = null;
auth.tokenPayload = null;
callHandler('logout');
};
auth.authenticate = function (profile, idToken, accessToken, state, refreshToken) {
return onSigninOk(idToken, accessToken, state, refreshToken, profile, true);
};
auth.getProfile = function (idToken) {
var getProfilePromisify = authUtils.promisify(config.auth0lib.getProfile, config.auth0lib);
auth.profilePromise = getProfilePromisify(idToken || auth.idToken);
return auth.profilePromise.then(function (profile) {
auth.profile = profile;
return profile;
});
};
return auth;
}
];
}
]);
}());
var unLinkAccount = function(primaryJWT, user_id, secondaryProvider, secondaryUserId){
return $http(
{
method: 'DELETE',
url: 'https://' + config.domain + '/api/v2/users/' + user_id + '/identities/' + secondaryProvider + '/' + secondaryUserId,
headers: {
Authorization: 'Bearer ' + primaryJWT
}
}
)
}
auth.hookEvents = function() {
// Does nothing. Hook events on application's run
};
auth.init = angular.bind(config, config.init);
/*
*
* DESCRIPTION: Fetch a delegation token
* INPUT: Config object
* OUTPUT: Promise
*
* */
auth.getToken = function(options) {
options = options || { scope: 'openid' };
if (!options.id_token && !options.refresh_token) {
options.id_token = auth.idToken;
}
var getDelegationTokenAsync = authUtils.promisify(config.auth0js.getDelegationToken, config.auth0js);
return getDelegationTokenAsync(options);
};
/*
*
* DESCRIPTION: Refresh Token
* INPUT: token (string)
* OUTPUT: Promise
*
* */
auth.refreshIdToken = function(refresh_token) {
var refreshTokenAsync = authUtils.promisify(config.auth0js.refreshToken, config.auth0js);
auth.refreshTokenPromise = refreshTokenAsync(refresh_token || auth.refreshToken).then(function (delegationResult) {
return delegationResult.id_token;
})['finally'](function() {
auth.refreshTokenPromise = null;
});
return auth.refreshTokenPromise;
};
/*
*
* DESCRIPTION: Renew user's token
* INPUT: token (string)
* OUTPUT: Promise
*
* */
auth.renewIdToken = function(id_token) {
var renewIdTokenAsync = authUtils.promisify(config.auth0js.renewIdToken, config.auth0js);
return renewIdTokenAsync(id_token || auth.idToken).then(function (delegationResult) {
return delegationResult.id_token;
});
};
/*
*
* DESCRIPTION: Sign a user in
* INPUT: config options, success callback fxn, err callback fxn, library name
* The Library name is either 'Auth0' or 'Auth0Lock'
*
* */
auth.signin = function(options, successCallback, errorCallback, libName) {
options = options || {};
checkHandlers(options, successCallback, errorCallback);
options = getInnerLibraryConfigField('parseOptions', libName)(options);
var signinMethod = getInnerLibraryMethod('signin', libName);
var successFn = !successCallback ? null : function(profile, idToken, accessToken, state, refreshToken) {
if (!idToken && !angular.isUndefined(options.loginAfterSignup) && !options.loginAfterSignup) {
successCallback();
} else {
onSigninOk(idToken, accessToken, state, refreshToken, profile).then(function(profile) {
if (successCallback) {
successCallback(profile, idToken, accessToken, state, refreshToken);
}
});
}
};
var errorFn = !errorCallback ? null : function(err) {
callHandler('loginFailure', { error: err });
if (errorCallback) {
errorCallback(err);
}
};
var signinCall = authUtils.callbackify(signinMethod, successFn, errorFn , innerAuth0libraryConfiguration[libName || config.lib].library());
signinCall(options);
};
/*
*
* DESCRIPTION: Sign's up a user
* INPUT: config options, success callback fxn, err callback fxn
*
* */
auth.signup = function(options, successCallback, errorCallback) {
options = options || {};
checkHandlers(options, successCallback, errorCallback);
options = getInnerLibraryConfigField('parseOptions')(options);
var successFn = !successCallback ? null : function(profile, idToken, accessToken, state, refreshToken) {
if (!angular.isUndefined(options.auto_login) && !options.auto_login) {
successCallback();
} else {
onSigninOk(idToken, accessToken, state, refreshToken, profile).then(function(profile) {
if (successCallback) {
successCallback(profile, idToken, accessToken, state, refreshToken);
}
});
}
};
var errorFn = !errorCallback ? null : function(err) {
callHandler('loginFailure', { error: err });
if (errorCallback) {
errorCallback(err);
}
};
var auth0lib = config.auth0lib;
var signupCall = authUtils.callbackify(getInnerLibraryMethod('signup'),successFn , errorFn, auth0lib);
signupCall(options);
};
/*
*
* DESCRIPTION: Link multiple accounts (e.g: FB, Twitter, Google)
*
* INPUT: primaryJWT (string): Initial JWT assigned to User,
* primaryProfile (object): Primary account user profile,
* options (object): Auth options
* Success Callback fxn, Err Callback fxn and Library Name
*
* */
auth.linkAccount = function (primaryJWT, primaryProfile, options, successCallback, errorCallback, libName) {
var defaultConfig = {popup: true};
if (!primaryJWT || !primaryProfile){
throw new Error('Available token and profile is needed to link to another');
}
if(!options.connection){
throw new Error('Connection type (eg: facebook, github) is required to link account');
}
options = options || {};
checkHandlers(options, successCallback, errorCallback);
angular.extend(options, defaultConfig);
options = getInnerLibraryConfigField('parseOptions', libName)(options);
var signinMethod = getInnerLibraryMethod('signin', libName);
var successFn = function(profile, idToken) {
linkAccount(primaryJWT, idToken, primaryProfile).then(function(response){
successCallback(response);
}, function(err) {
errorCallback(err);
});
};
var errorFn = function(err) {
if (errorCallback) {
errorCallback(err);
}
};
var linkAccountCall = authUtils.callbackify(signinMethod, successFn, errorFn , innerAuth0libraryConfiguration[libName || config.lib].library());
linkAccountCall(options);
};
/*
*
* DESCRIPTION: Unlink linked accounts
*
* INPUT: primaryJWT (string): Initial JWT assigned to User,
* user_id (string): Primary account user id,
* secondaryProvider (string): Provider of account to unlink (eg: Facebook),
* secondaryUserId: Secondary account user id
*
* OUTPUT: Promise
*
* */
auth.unLinkAccount = function (primaryJWT, user_id, secondaryProvider, secondaryUserId) {
if (!primaryJWT || !user_id || !secondaryProvider || !secondaryUserId){
throw new Error('All the arguments are required to unlink. Please refer to documentation for the arguments');
}
return unLinkAccount(primaryJWT, user_id, secondaryProvider, secondaryUserId);
};
/*
*
* DESCRIPTION: Performs forgot your password flow
*
* INPUT: config options (object), Callbacks
*
*
* */
auth.reset = function(options, successCallback, errorCallback) {
options = options || {};
options = getInnerLibraryConfigField('parseOptions')(options);
var auth0lib = config.auth0lib;
var resetCall = authUtils.callbackify(getInnerLibraryMethod('reset'), successCallback, errorCallback, auth0lib);
resetCall(options);
};
auth.validateUser = function(options, successCallback, errorCallback) {
options = options || {};
options = getInnerLibraryConfigField('parseOptions')(options);
var auth0lib = config.auth0lib;
var validateUserCall = authUtils.callbackify(getInnerLibraryMethod('validateUser'), successCallback, errorCallback, auth0lib);
validateUserCall(options);
};
/*
*
* DESCRIPTION: Sign user out
*
*
* */
auth.signout = function() {
auth.isAuthenticated = false;
auth.profile = null;
auth.profilePromise = null;
auth.idToken = null;
auth.state = null;
auth.accessToken = null;
auth.tokenPayload = null;
$rootScope.isAuthenticated = false;
callHandler('logout');
};
auth.authenticate = function(profile, idToken, accessToken, state, refreshToken) {
return onSigninOk(idToken, accessToken, state, refreshToken, profile, true);
};
/*
*
* DESCRIPTION: Fetch user profile
*
* INPUT: token (string)
* OUTPUT: Promise
*
* */
auth.getProfile = function(idToken) {
var getProfilePromisify = authUtils.promisify(config.auth0lib.getProfile, config.auth0lib);
auth.profilePromise = getProfilePromisify(idToken || auth.idToken);
return auth.profilePromise.then(function(profile) {
auth.profile = profile;
return profile;
});
};
auth.hide = function(callback) {
config.auth0lib.hide(callback);
};
return auth;
}];
}]);t
angular.module('auth0.directives', ['auth0.service']);
angular.module('auth0.directives')
.directive('ifUser', ["$rootScope", function($rootScope){
return {
link: function(scope, element){
$rootScope.$watch('isAuthenticated',function(isAuth){
if(isAuth){
element.removeClass('ng-hide');
}else{
element.addClass('ng-hide');
}
});
}
};
}]);

@@ -1,1 +0,1 @@

!function(){angular.module("auth0",["auth0.service","auth0.utils"]).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(null!=Auth0Widget)throw new Error("Auth0Widget is not supported with this version of auth0-angularanymore. Please try with an older one");throw new Error("Cannott initialize Auth0Angular. Auth0Lock or Auth0 must be available")}var e={callbackOnLocationHash:!0},f=this,g={Auth0:{signin:"login",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",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.loginState=a.loginState,this.clientID=a.clientID||a.clientId;var c=a.domain;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",function(a,d,e,h,i,j){function k(){f.loginUrl?i.path(f.loginUrl):f.loginState?e.get("$state").go(f.loginState):n("forbidden")}var l={isAuthenticated:!1},m=function(a){return f.eventHandlers[a]},n=function(b,c){a.$broadcast("auth0."+b,c),angular.forEach(m(b)||[],function(a){e.invoke(a,l,c)})},o=function(a,b,c,d,e,f){var g=l.getProfile(a),h={idToken:a,accessToken:b,state:c,refreshToken:d,profile:e,isAuthenticated:!0};return angular.extend(l,h),n(f?"authenticated":"loginSuccess",angular.extend({profilePromise:g},h)),g};a.$on("$locationChangeStart",function(){if(f.initialized){var a=f.auth0lib.parseHash(h.location.hash);if(!l.isAuthenticated){if(a&&a.id_token)return void o(a.id_token,a.access_token,a.state,a.refresh_token);f.sso&&f.auth0js.getSSOData(j.applied(function(a,b){if(b.sso){var c={popup:!1,callbackOnLocationHash:!0,connection:b.lastUsedConnection.name};n("ssoLogin",{loginOptions:c}),l.signin(c,null,null,"Auth0")}}))}}}),a.$on("auth0.forbiddenRequest",function(){k()}),f.loginUrl&&a.$on("$routeChangeStart",function(a,b){f.initialized&&b.$$route&&b.$$route.requiresLogin&&(l.isAuthenticated||l.refreshTokenPromise||i.path(f.loginUrl))}),f.loginState&&a.$on("$stateChangeStart",function(a,b){f.initialized&&b.data&&b.data.requiresLogin&&(l.isAuthenticated||l.refreshTokenPromise||(a.preventDefault(),e.get("$state").go(f.loginState)))}),l.config=f;var p=function(a,b){var c=m("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")};return l.hookEvents=function(){},l.init=angular.bind(f,f.init),l.getToken=function(a){a=a||{scope:"openid"},a.id_token||a.refresh_token||(a.id_token=l.idToken);var b=j.promisify(f.auth0js.getDelegationToken,f.auth0js);return b(a)},l.refreshIdToken=function(a){var b=j.promisify(f.auth0js.refreshToken,f.auth0js);return l.refreshTokenPromise=b(a||l.refreshToken).then(function(a){return a.id_token})["finally"](function(){l.refreshTokenPromise=null}),l.refreshTokenPromise},l.renewIdToken=function(a){var b=j.promisify(f.auth0js.renewIdToken,f.auth0js);return b(a||l.idToken).then(function(a){return a.id_token})},l.signin=function(a,d,e,h){a=a||{},p(a,d,e),a=c("parseOptions",h)(a);var i=b("signin",h),k=d?function(b,c,e,f,g){c||angular.isUndefined(a.loginAfterSignup)||a.loginAfterSignup?o(c,e,f,g,b).then(function(a){d&&d(a,c,e,f,g)}):d()}:null,l=e?function(a){n("loginFailure",{error:a}),e&&e(a)}:null,m=j.callbackify(i,k,l,g[h||f.lib].library());m(a)},l.signup=function(a,d,e){a=a||{},p(a,d,e),a=c("parseOptions")(a);var g=d?function(b,c,e,f,g){angular.isUndefined(a.auto_login)||a.auto_login?o(c,e,f,g,b).then(function(a){d&&d(a,c,e,f,g)}):d()}:null,h=e?function(a){n("loginFailure",{error:a}),e&&e(a)}:null,i=f.auth0lib,k=j.callbackify(b("signup"),g,h,i);k(a)},l.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)},l.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)},l.signout=function(){l.isAuthenticated=!1,l.profile=null,l.profilePromise=null,l.idToken=null,l.state=null,l.accessToken=null,l.tokenPayload=null,n("logout")},l.authenticate=function(a,b,c,d,e){return o(b,c,d,e,a,!0)},l.getProfile=function(a){var b=j.promisify(f.auth0lib.getProfile,f.auth0lib);return l.profilePromise=b(a||l.idToken),l.profilePromise.then(function(a){return l.profile=a,a})},l}]}])}();
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",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",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.loginState=a.loginState,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.loginState?e.get("$state").go(f.loginState):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){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.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)})}),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||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}]}]),t,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")})}}}]);
## Linking Accounts
To use the account linking feature a user needs to be logged in with 'Account A' (eg: Google) after which he can start the account linking to link 'Account B' (eg: Facebook) to his original account.
This flow is based on the access token of the current user and [is documented here](https://auth0.com/docs/link-accounts).
## Example
In order to link two accounts, create a link method in a controller (make sure to have the `auth` object injected):

@@ -7,3 +13,3 @@

$scope.link = function () {
auth.auth0js._callbackOnLocationHash = true;
auth.config.auth0js._callbackOnLocationHash = true;
auth.signin({

@@ -68,1 +74,46 @@ authParams: {

```
## Advanced Configuration
When we sign in we typically only store the `profile` and the `idToken`. For the account linking feature to work correctly (even after closing and reopening the browser or refreshing the page) we'll need to store the access token.
```js
auth.signin({ }, function(profile, idToken, accessToken) {
store.set('profile', profile);
store.set('token', idToken);
store.set('accessToken', accessToken);
$location.path("/");
}, function(error) {
console.log("There was an error logging in", error);
});
```
When logging out we'll also need to cleanup the access token:
```js
$scope.logout = function() {
auth.signout();
store.remove('profile');
store.remove('token');
store.remove('accessToken');
$location.path('/login');
}
```
At application startup we always initialize the module by calling `auth.authenticate`. Now we're updating this call to also include the access token. By adding this we'll be able to use the account linking feature even if the user refreshes the page or closes/reopens the browser:
```js
$rootScope.$on('$locationChangeStart', function() {
if (!auth.isAuthenticated) {
var token = store.get('token');
if (token) {
if (!jwtHelper.isTokenExpired(token)) {
auth.authenticate(store.get('profile'), token, store.get('accessToken'));
} else {
$location.path('/login');
}
}
}
});
```

@@ -47,3 +47,3 @@ var myApp = angular.module('myApp');

});
}
};

@@ -50,0 +50,0 @@ $scope.submit = function () {

@@ -33,3 +33,3 @@ var myApp = angular.module('myApp', [

return store.get('token');
}
};

@@ -36,0 +36,0 @@ // Add a simple interceptor that will fetch all requests and add the jwt token to its authorization header.

@@ -45,7 +45,7 @@ var myApp = angular.module('myApp');

$scope.doSignup = function () {
$http({method: 'POST', url: '/custom-signup',
$http({method: 'POST', url: 'http://localhost:3001/custom-signup',
data: {
email: $scope.signup.user,
password: $scope.signup.pass,
favColor: $scope.signup.favColor
user_metadata: { favColor: $scope.signup.favColor }
}})

@@ -52,0 +52,0 @@ .success(function (data, status, headers, config) {

@@ -35,3 +35,3 @@ var myApp = angular.module('myApp', [

return store.get('token');
}
};

@@ -38,0 +38,0 @@ // Add a simple interceptor that will fetch all requests and add the jwt token to its authorization header.

@@ -6,4 +6,2 @@ var resolve = require('path').resolve;

var SECRET = 'A92LWsdBgH6legaUm8U3uyJ7n1bdEik7WvO8nQab9LlHTtnawpRx8d-HPqW0b2g-';
app.use(express.logger());

@@ -18,9 +16,8 @@

var Auth0 = require('auth0');
var Auth0 = require('auth0').ManagementClient;
var extend = require('xtend');
var api = new Auth0({
domain: 'contoso.auth0.com',
clientID: 'DyG9nCwIEofSy66QM3oo5xU6NFs3TmvT',
clientSecret: SECRET
token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJFb2JoYWVoTXFXdDdnT0JZR0hwenRDUkh5SVZ4enlrUiIsInNjb3BlcyI6eyJ1c2VycyI6eyJhY3Rpb25zIjpbImNyZWF0ZSJdfX0sImlhdCI6MTQ2MDA4MjkwOCwianRpIjoiYTNkZDU3ZDU3YTRhYThkZjk0ZjYwODVjYTU4NjQ2YzcifQ.rg4uUftBNS9p2ZO0I7Y-6FuqPR4cbjivF3t5znPdiZs',
domain: 'contoso.auth0.com'
});

@@ -31,6 +28,16 @@

app.use(express.bodyParser());
app.use(function (req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
next();
});
app.use('/custom-signup', function (req, res) {
app.use(express.bodyParser());
app.post('/custom-signup', function (req, res) {
console.log("req.body: ", JSON.stringify(req.body));
var data = extend(req.body, {connection: CONNECTION, email_verified: false});
console.log("Data: ", JSON.stringify(data));
api.createUser(data, function (err) {

@@ -44,7 +51,7 @@ if (err) {

res.send(200);
return;
});
});
app.listen(3000);
console.log('listening on port http://localhost:3000');
app.listen(3001);
console.log('listening on port http://localhost:3001');

@@ -11,2 +11,4 @@ # Custom Signup Example

```
Replace your Auth0 Domain and a valid APIv2 token with user:create scope in the `nodejs/app.js` file.
Replace your Auth0 Domain and a ClientID in the `client/scripts/myApp.js` file.
After doing that, start the server by doing:

@@ -16,3 +18,8 @@ ```sh

```
Finally, serve the frontend by going to the `client` folder and run:
```sh
npm install -g serve
serve
```
and point your browser to [http://localhost:3000/](http://localhost:3000).

@@ -19,3 +19,3 @@ var myApp = angular.module('myApp', [

controller: 'RootCtrl',
/* isAuthenticated will prevent user access to forbidden routes */
/* requiresLogin will prevent user access to forbidden routes */
requiresLogin: true

@@ -27,4 +27,4 @@ });

authProvider.init({
clientID: 'BUIJSW9x60sIHBw8Kd9EmCbj8eDIFxDC',
domain: 'samples.auth0.com',
clientID: 'DyG9nCwIEofSy66QM3oo5xU6NFs3TmvT',
domain: 'contoso.auth0.com',
callbackURL: location.href,

@@ -47,3 +47,3 @@ loginUrl: '/login'

}
}
};

@@ -50,0 +50,0 @@ // Add a simple interceptor that will fetch all requests and add the jwt token to its authorization header.

# Token Delegation Example
This example show Angularjs client side authentication + server side authentication to two different APIs. A delegation token is requested in order to communicate with the secondary API.
To learn more about delegation tokens go to: https://auth0.com/docs/tokens/delegation

@@ -9,2 +10,4 @@ In order to run the example, in this current folder and run:

```
Next, make sure to have created two Apps under your Auth0 Dashboard.
Also, set your two apps Domain, ClientID (or Audience) and Client Secret in the `server.js` and the `client/scripts/myApp.js` files.
After doing that, start the server by doing:

@@ -11,0 +14,0 @@ ```sh

@@ -42,3 +42,3 @@ angular.module('auth0-sample', ['auth0', 'ngRoute', 'angular-jwt', 'angular-storage'])

return store.get('token');
}
};

@@ -45,0 +45,0 @@ // Add a simple interceptor that will fetch all requests and add the jwt token to its authorization header.

@@ -45,3 +45,3 @@ var myApp = angular.module('myApp', [

console.log("Logged out");
})
});

@@ -54,3 +54,3 @@ // Add a simple interceptor that will fetch all requests and add the jwt token to its authorization header.

return store.get('token');
}
};

@@ -57,0 +57,0 @@ // Add a simple interceptor that will fetch all requests and add the jwt token to its authorization header.

@@ -58,3 +58,3 @@ angular.module( 'sample', [

}
}
};

@@ -61,0 +61,0 @@ $httpProvider.interceptors.push('jwtInterceptor');

@@ -18,3 +18,3 @@ angular.module( 'sample.home', [

});
}
};

@@ -21,0 +21,0 @@ $scope.logout = function() {

@@ -5,3 +5,3 @@ # Refresh Token with on auth0-angular

> **Warning**: Refresh tokens should really only be used in *mobile applications* (i.e. in Ionic) and not web apps. This is because with a stored `refreshToken` you'll always be able to get a usable `idToken` unless the `refreshToken` is revoked. This is not safe in a browser scenario since that browser could be running on a shared or public computer. See [this docs page](../../docs/refresh-token.md#using-refresh-tokens-in-mobile-applications) for more info the proper use of refresh tokens.
> **Warning**: Refresh tokens should really only be used in *mobile applications* (i.e. in Ionic) and not web apps. This is because with a stored `refreshToken` you'll always be able to get a usable `idToken` unless the `refreshToken` is revoked. This is not safe in a browser scenario since that browser could be running on a shared or public computer. See [this docs page](../../docs/refresh-token.md#using-refresh-tokens-in-mobile-applications) for more info about the proper use of refresh tokens.

@@ -8,0 +8,0 @@ ## Running the example

@@ -5,6 +5,6 @@ require.config({

'angular-route': '//ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular-route',
'auth-angular': '//cdn.auth0.com/w2/auth0-angular-4.js',
'auth0-angular': '//cdn.auth0.com/w2/auth0-angular-4',
'angular-jwt': '//cdn.rawgit.com/auth0/angular-jwt/master/dist/angular-jwt',
'angular-storage': '//cdn.rawgit.com/auth0/angular-storage/master/dist/angular-storage',
'auth0': '//cdn.auth0.com/w2/auth0-6.7.js'
'auth0': '//cdn.auth0.com/w2/auth0-6.7'
},

@@ -11,0 +11,0 @@ shim: {

@@ -59,3 +59,3 @@ define(['angular', './myApp'], function (angular, myApp) {

myApp.controller('LogoutCtrl', function (auth, $scope, $location) {
myApp.controller('LogoutCtrl', function (auth, $scope, $location, store) {
auth.signout();

@@ -62,0 +62,0 @@ store.remove('profile');

@@ -40,3 +40,3 @@ define(['angular', 'auth0', 'auth0-angular', 'angular-route', 'angular-jwt', 'angular-storage'], function (angular, Auth0) {

return store.get('token');
}
};

@@ -43,0 +43,0 @@ // Add a simple interceptor that will fetch all requests and add the jwt token to its authorization header.

@@ -49,6 +49,7 @@ # SSO Example

127.0.0.1 app1.com
127.0.0.1 app2.com
````
Once that's done, just start this project twice in different ports. For that, we recommend using `serve` which is installed with `npm`by doing `npm i -g serve`.
Then just run these commands on separate terminals.
````

@@ -55,0 +56,0 @@ serve --port 3001

@@ -23,7 +23,11 @@ var myApp = angular.module('myApp');

myApp.controller('LogoutCtrl', function (auth, $location, store) {
myApp.controller('LogoutCtrl', function (auth, $window, store) {
auth.signout();
store.remove('profile');
store.remove('token');
$location.path('/login');
$window.location.href = 'https://samples.auth0.com/v2/logout?returnTo=' + $window.location.origin + $window.location.pathname;
});
myApp.controller('SecureCtrl', function (auth, $window, store) {
});

@@ -17,2 +17,7 @@ var myApp = angular.module('myApp', [

})
.when('/secure', {
templateUrl: 'views/secure.html',
controller: 'SecureCtrl',
requiresLogin: true
})
.when('/', {

@@ -32,3 +37,3 @@ templateUrl: 'views/root.html',

authProvider.on('loginSuccess', function($location, profilePromise, idToken, store) {
authProvider.on('loginSuccess', function($location, profilePromise, idToken, store, state) {
$location.path('/');

@@ -47,3 +52,3 @@ profilePromise.then(function(profile) {

return store.get('token');
}
};

@@ -55,3 +60,3 @@ // Add a simple interceptor that will fetch all requests and add the jwt token to its authorization header.

}).run(function($rootScope, auth, store, jwtHelper, $location) {
$rootScope.$on('$locationChangeStart', function() {
function checkForToken() {
if (!auth.isAuthenticated) {

@@ -62,9 +67,10 @@ var token = store.get('token');

auth.authenticate(store.get('profile'), token);
} else {
$location.path('/login');
}
}
}
}
checkForToken();
});
$rootScope.$on('$locationChangeStart', checkForToken);
});

@@ -46,3 +46,3 @@ var myApp = angular.module('myApp', [

return store.get('token');
}
};

@@ -49,0 +49,0 @@ // Add a simple interceptor that will fetch all requests and add the jwt token to its authorization header.

@@ -1,16 +0,15 @@

# Widget Example
# Auth0 + AngularJS + API Seed
Using Auth0 Login Widget.
This is the seed project you need to use if you're going to create an AngularJS app that will use Auth0 and an API that you're going to be developing. That API can be in any language.
### Running the example
In order to run the example, install `serve` to host static assets:
If you want to connect to a third party API like Firebase or Amazon, please check [this other seed](https://github.com/auth0/auth0-angular/tree/master/examples/widget-with-thirdparty-api).
```sh
npm -g install serve
```
## Running the example
Then execute on the example folder:
```sh
serve
```
and point your browser to [http://localhost:3000/](http://localhost:3000).
In order to run the example you need to just start a server. What we suggest is doing the following:
1. Install node
1. run npm install -g serve
1. run serve in the directory of this project.
Go to [http://localhost:3000](http://localhost:3000) and you'll see the app running :).

@@ -33,3 +33,3 @@ angular.module( 'sample', [

return store.get('token');
}
};

@@ -36,0 +36,0 @@ // Add a simple interceptor that will fetch all requests and add the jwt token to its authorization header.

@@ -16,3 +16,3 @@ angular.module( 'sample.home', [

}, function(response) {
if (response.status == 0) {
if (response.status == -1) {
alert("Please download the API seed so that you can call it.");

@@ -24,3 +24,3 @@ }

});
}
};

@@ -27,0 +27,0 @@ $scope.logout = function() {

@@ -33,3 +33,3 @@ angular.module( 'sample', [

return store.get('token');
}
};

@@ -36,0 +36,0 @@ // Add a simple interceptor that will fetch all requests and add the jwt token to its authorization header.

# Auth0 + AngularJS + API Seed
This is the seed project you need to use if you're going to create an AngularJS app that will use Auth0 and an API that you're going to be developing. That API can be in any language.
This is the seed project you need to use if you're going to create an AngularJS app that will use Auth0 and connect to a third party API like Firebase or Amazon.
If you want to connect to a third party API like Firebase or Amazon, please check [this other seed](https://github.com/auth0/auth0-angular/tree/master/examples/widget-with-thirdparty-api).
## Running the example

@@ -8,0 +6,0 @@

@@ -11,3 +11,3 @@ var myApp = angular.module('myApp');

store.set('token', token);
}
};

@@ -21,3 +21,3 @@ $scope.signup = function() {

})
}
};

@@ -24,0 +24,0 @@ $scope.reset = function () {

@@ -32,3 +32,3 @@ var myApp = angular.module('myApp', [

return store.get('token');
}
};

@@ -35,0 +35,0 @@ // Add a simple interceptor that will fetch all requests and add the jwt token to its authorization header.

@@ -56,9 +56,3 @@ var pkg = require('./package');

},
ngmin: {
dist: {
files: [ { expand: true, cwd: 'src', src: '**/*.js', dest: 'build/' } ]
}
},
concat: {

@@ -68,3 +62,12 @@ options: {

},
dist: { dest: 'build/auth0-angular.js', src: ['build/auth0-angular.js'] }
dist: {
dest: 'build/auth0-angular.js',
src: [
'src/auth0.js',
'src/services/auth0.utils.js',
'src/services/auth0.service.js',
'src/directives/auth0.directive.js',
'src/directives/ifUser.directive.js'
]
}
},

@@ -107,3 +110,3 @@

flatten: true,
src: 'build/*',
src: 'build/auth0-angular.js',
dest: 'release/',

@@ -114,3 +117,3 @@ rename: renameRelease(pkg.version)

flatten: true,
src: 'build/*',
src: 'build/auth0-angular.js',
dest: 'release/',

@@ -121,3 +124,3 @@ rename: renameRelease(minorVersion)

flatten: true,
src: 'build/*',
src: 'build/auth0-angular.js',
dest: 'release/',

@@ -164,31 +167,35 @@ rename: renameRelease(majorVersion)

},
s3: {
aws_s3: {
options: {
key: process.env.S3_KEY,
secret: process.env.S3_SECRET,
bucket: process.env.S3_BUCKET,
access: 'public-read',
headers: {
'Cache-Control': 'public, max-age=300'
}
accessKeyId: process.env.S3_KEY,
secretAccessKey: process.env.S3_SECRET,
bucket: process.env.S3_BUCKET,
region: process.env.S3_REGION,
uploadConcurrency: 5,
params: {
CacheControl: 'public, max-age=300'
},
// debug: true <<< use this option to test changes
},
clean: {
del: [
{ src: 'w2/auth0-angular-' + pkg.version + '.js', },
{ src: 'w2/auth0-angular-' + pkg.version + '.min.js', },
{ src: 'w2/auth0-angular-' + majorVersion + '.js', },
{ src: 'w2/auth0-angular-' + majorVersion + '.min.js', },
{ src: 'w2/auth0-angular-' + minorVersion + '.js', },
{ src: 'w2/auth0-angular-' + minorVersion + '.min.js', },
{ src: 'w2/auth0-angular-' + minorVersion + '.min.js', }
files: [
{ action: 'delete', dest: 'w2/auth0-angular-' + pkg.version + '.js', },
{ action: 'delete', dest: 'w2/auth0-angular-' + pkg.version + '.min.js', },
{ action: 'delete', dest: 'w2/auth0-angular-' + majorVersion + '.js', },
{ action: 'delete', dest: 'w2/auth0-angular-' + majorVersion + '.min.js', },
{ action: 'delete', dest: 'w2/auth0-angular-' + minorVersion + '.js', },
{ action: 'delete', dest: 'w2/auth0-angular-' + minorVersion + '.min.js', },
{ action: 'delete', dest: 'w2/auth0-angular-' + minorVersion + '.min.js', }
]
},
publish: {
upload: [{
src: 'release/*',
dest: 'w2/',
options: { gzip: false }
}]
}
files: [
{
expand: true,
cwd: 'release/',
src: ['*'],
dest: 'w2/'
}
]
},
},

@@ -235,3 +242,3 @@ http: {

grunt.registerTask('build', ['clean', 'jshint', 'ngmin', 'concat', 'uglify', 'karma', 'copy']);
grunt.registerTask('build', ['clean', 'jshint', 'concat', 'uglify', 'karma', 'copy']);
grunt.registerTask('test', ['build', 'karma']);

@@ -241,3 +248,3 @@ grunt.registerTask('scenario', ['build', 'connect:scenario_custom_login', 'protractor:local']);

grunt.registerTask('purge_cdn', ['http:purge_js', 'http:purge_js_min', 'http:purge_major_js', 'http:purge_major_js_min', 'http:purge_minor_js', 'http:purge_minor_js_min']);
grunt.registerTask('cdn', ['build', 's3', 'purge_cdn']);
grunt.registerTask('cdn', ['build', 'aws_s3', 'purge_cdn']);

@@ -244,0 +251,0 @@ grunt.registerTask('default', ['build', 'watch']);

@@ -22,3 +22,2 @@ // Karma configuration

'bower_components/angular-mocks/angular-mocks.js',
'bower_components/angular-cookies/angular-cookies.js',
'bower_components/angular-route/angular-route.js',

@@ -41,3 +40,3 @@

preprocessors: {
'build/auth0-angular.js': 'coverage'
},

@@ -49,3 +48,3 @@

// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress'],
reporters: ['progress', 'coverage'],

@@ -52,0 +51,0 @@

@@ -6,4 +6,4 @@ {

"author": "Martin Gontovnikas",
"version": "4.1.0",
"main": "./build/auth0-angular.js",
"version": "4.2.0",
"main": "index.js",
"devDependencies": {

@@ -13,2 +13,3 @@ "bower": "^1.3.3",

"grunt": "~0.4.5",
"grunt-aws-s3": "~0.9.3",
"grunt-cli": "^0.1.13",

@@ -27,8 +28,8 @@ "grunt-contrib-clean": "~0.5.0",

"grunt-protractor-webdriver": "^0.1.6",
"grunt-s3": "~0.2.0-alpha.3",
"karma": "0.12.37",
"karma-chai": "^0.1.0",
"karma-chrome-launcher": "~0.1",
"karma-coverage": "^1.0.0",
"karma-mocha": "^0.1.3",
"karma-phantomjs-launcher": "^0.1.3",
"karma-phantomjs-launcher": "^1.0.0",
"karma-sinon": "^1.0.3",

@@ -38,2 +39,3 @@ "matchdep": "^0.3.0",

"phantomjs": "^1.9.0",
"phantomjs-prebuilt": "^2.1.7",
"protractor": "^0.21.0",

@@ -45,3 +47,4 @@ "selenium-webdriver": "^2.41.0",

"scripts": {
"test": "bower install && grunt test -v"
"test": "bower install && grunt test -v",
"cdn": "grunt cdn"
},

@@ -48,0 +51,0 @@ "repository": {

@@ -31,3 +31,3 @@ # Auth0 and AngularJS

````html
<script type="text/javascript" src="//cdn.auth0.com/js/lock-7.js"></script>
<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.js"></script>

@@ -112,3 +112,3 @@ ````

There are three modes to handle authentication with all the providers (e.g. Facebook, Linkedin, GitGub, AD, LDAP) that Auth0 can handle: redirect, popup, and resource owner (`/oauth/ro`) CORS calls.
There are three modes to handle authentication with all the providers (e.g. Facebook, Linkedin, GitHub, AD, LDAP) that Auth0 can handle: redirect, popup, and resource owner (`/oauth/ro`) CORS calls.

@@ -180,3 +180,3 @@ When using **redirect mode**, the user will be redirected to the provider's login page for authentication.

// Error
})
}, 'Auth0')
```

@@ -227,3 +227,3 @@

If using Lock, the widget will be displayed in "reset password" mode.
In this case, this method accepts the options and parameters as [`auth.signin`]((#authsigninoptions-successcallback-errorcallback).
In this case, this method accepts the options and parameters as [`auth.signin`](#authsigninoptions-successcallback-errorcallback).

@@ -252,2 +252,9 @@ #### auth.signout()

### auth.linkAccount(token, profile, options, successCallback, errCallback)
API to link multiple accounts to primary account
Note that `options.connection` must be provided because it tells Auth0 which account to link to
#### auth.id_token, auth.access_token, auth.state

@@ -430,12 +437,5 @@

## Reporting issues
If you have found a bug or have a feature request, please report it in as an issue in this repository.
Please do not report security vulnerabilities in public. The [Responsible Disclosure Program](https://auth0.com/whitehat) details the procedure for disclosing security issues.
## Contributing
[Read here how to run auth0-angular tests](docs/testing.md)
## What is Auth0?

@@ -456,1 +456,13 @@

2. Use Google, GitHub or Microsoft Account to login.
## Issue Reporting
If you have found a bug or if you have a feature request, please report them at this repository issues section. Please do not report security vulnerabilities on the public GitHub issue tracker. The [Responsible Disclosure Program](https://auth0.com/whitehat) details the procedure for disclosing security issues.
## Author
[Auth0](auth0.com)
## License
This project is licensed under the MIT license. See the [LICENSE](LICENSE) file for more info.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc