modules/orionode/lib/user.js
function oauth(id, username, email, req, done) {
	if (req.params["0"] === "/link") {
		return done(null, {
			__linkUser: true,
			email: email,
			username: username,
			id: id
		});
	}
	fileUtil.getMetastoreSafe(req).then(function(store) {
		store.getUserByOAuth(id, function(err, user) {
			if (err) {
				return done(err);
			}
			if (!user) {
				return done(null, {
					__newUser: true,
					email: email,
					username: username,
					id: id
				});
			}
			done(null, user);
		}, function noMetastore(err) {
			done(err);
		});
	});
}
function oauth(id, username, email, req, done) {
	if (req.params["0"] === "/link") {
		return done(null, {
			__linkUser: true,
			email: email,
			username: username,
			id: id
		});
	}
	fileUtil.getMetastoreSafe(req).then(function(store) {
		store.getUserByOAuth(id, function(err, user) {
			if (err) {
				return done(err);
			}
			if (!user) {
				return done(null, {
					__newUser: true,
					email: email,
					username: username,
					id: id
				});
			}
			done(null, user);
		}, function noMetastore(err) {
			done(err);
		});
	});
}
function oauth ( id , username , email , req , done ) { if ( req . params [ "0" ] === "/link" ) { return done ( null , { __linkUser : true , email : email , username : username , id : id } ) ; } fileUtil . getMetastoreSafe ( req ) . then ( function ( store ) { store . getUserByOAuth ( id , function ( err , user ) { if ( err ) { return done ( err ) ; } if ( ! user ) { return done ( null , { __newUser : true , email : email , username : username , id : id } ) ; } done ( null , user ) ; } , function noMetastore ( err ) { done ( err ) ; } ) ; } ) ; }
Do OAuth authentication
@param {string} id
@param {string} username
@param {string} email
@param {XMLHttpRequest} req
@param {fn(Error, {?})} done
Do OAuth authentication