I have this for my upstart... things are not going too well... when the user is invalid.. it works.. however when the user is valid... it says Invalid Authentication Data....
can someone brighten my day?
var os = require('os');
var path = require('path');
var codebox = require('codebox');
var users = {
'imran.codely@gmail.com': 'imranismail',
'dev': 'codemalaysia'
};
var config = {
'root': path.resolve('/home/dev/codebox/'),
'title': 'Imran\'s Playground',
'public': false,
'dev': false,
'workspace': {
'id': null // Default will be a hash of the root path
},
'hooks': {
// Auth: send auth infos and get status and user settings
'auth': function(data) {
if (!data.email || !data.token) throw "Need 'token' and 'email' for auth hook";
var userId = data.email;
var token = data.token;
if (!users[userId] || token != users[userId]) throw "Invalid user";
return {
'id': userId,
'name': userId,
'token': data.token,
'email': data.email
};
}//,
// Events: send events to a hook
//'events': process.env.WORKSPACE_HOOK_EVENTS,
// Settings: send user settings to a hook
//'settings': process.env.WORKSPACE_HOOK_SETTINGS,
// Valid addons installation with a hook
//'addons': process.env.WORKSPACE_HOOK_ADDONS
},
'webhook': {
// Token to pass as Authorization header
'authToken': null
},
'addons': {
// Base path
'path': path.resolve(__dirname + '/.codebox/.addons'),
'defaultsPath': path.resolve(require.resolve('codebox'), '../addons'),
'tempPath': os.tmpDir(),
'blacklist': ''.split(',')
},
'users': {
// Max number of collaborators
'max': 10,
// Default auth email
'defaultEmail': null,
'defaultToken': null,
// Use git for auth
'gitDefault': true
},
'proc': {
'urlPattern': 'http://localhost:%d'
},
'server': {
'hostname': '0.0.0.0',
'port': 8000
},
'settings': {
'path': path.resolve(__dirname + '/settings.json')
}
};
codebox.start(config).then(function() {
console.log('codebox is running');
}, function(err) {
console.log('Error: ', err);
});
I have this for my upstart... things are not going too well... when the user is invalid.. it works.. however when the user is valid... it says Invalid Authentication Data....
can someone brighten my day?