var AUTH0_DOMAIN = xxxxxxxxx;
var AUTH0_CLIENTID = yyyyyyyyy;
var webAuth = new auth0.WebAuth({
domain: AUTH0_DOMAIN,
clientID: AUTH0_CLIENTID
});
var _connectSocial = function(socialName) {
webAuth.popup.authorize({
connection: socialName,
responseType: \'token id_token\',
scope: \'openid profile\',
redirectUri: window.location.href
},function(err, authResult) {
if (err &&
err.original != undefined)
return console.log("Error Authentication: "+err.original);
});
};
var _login = function(user,pass) {
webAuth.login({
email: user,
password: pass,
responseType: \'token id_token\',
scope: \'openid profile user_metadata\',
redirectUri: window.location.href
});
};
var _signup = function() {
webAuth.signup({
connection: \'Username-Password-Authentication\',
email: "testuser@gmail.com",
password: "123456",
user_metadata: {
//...
}
},function (err) {
if (err) return alert(\'Something went wrong: \' + err.message);
webAuth.checkSession({}, function (err, authResult) {
_validate(authResult);
});
});
};