document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. var AUTH0_DOMAIN    = xxxxxxxxx;
  2. var AUTH0_CLIENTID  = yyyyyyyyy;
  3.  
  4. var webAuth = new auth0.WebAuth({
  5.   domain:   AUTH0_DOMAIN,
  6.   clientID: AUTH0_CLIENTID
  7. });
  8.  
  9. var _connectSocial = function(socialName) {
  10.   webAuth.popup.authorize({
  11.     connection: socialName,
  12.     responseType: \'token id_token\',
  13.     scope: \'openid profile\',
  14.     redirectUri: window.location.href
  15.   },function(err, authResult) {
  16.     if (err &&
  17.         err.original != undefined)
  18.         return console.log("Error Authentication: "+err.original);
  19.   });
  20. };
  21. var _login = function(user,pass) {
  22.   webAuth.login({
  23.     email: user,
  24.     password: pass,
  25.     responseType: \'token id_token\',
  26.     scope: \'openid profile user_metadata\',
  27.     redirectUri: window.location.href
  28.   });
  29. };
  30.  
  31. var _signup = function() {
  32.   webAuth.signup({
  33.     connection: \'Username-Password-Authentication\',
  34.     email: "testuser@gmail.com",
  35.     password: "123456",
  36.     user_metadata: {
  37.       //...
  38.     }
  39.   },function (err) {
  40.     if (err) return alert(\'Something went wrong: \' + err.message);
  41.     webAuth.checkSession({}, function (err, authResult) {
  42.       _validate(authResult);
  43.     });
  44.   });
  45. };
');