NOTE: This post requires that you have a web app set up through Facebook, Google, Twitter and/or Linkedin before continuing. To learn what OAuth is and/or how to set it up, check out my post entitled, “What is OAuth and How Does it Work?”
Mean.js supports OAuth right out of the box, but it takes a bit of setting up.
The configuration files are found in /config/env/. The default file is ‘development.js’. All that’s necessary to install basic OAuth for user authentication is to fill in the ‘ClientId’, ‘ClientSecret’ and ‘callbackUrl’ elements with their respective values. Make sure your callback URL has been registered as allowed with your app!
Because all OAuth user data can be loaded using AngularJS directly into the user’s browser, if you don’t need to record data about your user you can just grab anything you want directly with Angular. Server-side OAuth should really be reserved for logging in and out.
If I’m wrong or missing something, comment and let me know!
This article details how to install mean.io from scratch on Ubuntu 12.04, complete with bash script you can just download and run on your machine.
I’ll update this periodically as this process changes. This article was last updated April 11, 2014.
First we need to install node.js, npm and bower.
# Update repositories
sudo apt-get update
# Install git
sudo apt-get -y install git
# Install build tools
sudo apt-get -y install build-essential
# Clone node.js source code
git clone https://github.com/joyent/node.git
# Configure, make and install from source
cd node && git checkout v0.10.26-release
make && sudo make install
sudo npm install -g bower
sudo npm install -g grunt-cli
sudo npm install -g yo
Before we can install mean.js, we need to install and start MongoDb.
# Add the mongo repository information and update
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
sudo apt-get update
# Install Mongo
sudo apt-get -y install mongodb-org
Next, let’s scaffold our mean.js application with Yeoman
sudo npm install -g generator-meanjs
cd .. && mkdir myNewMeanProject
# Start your MEAN server on port 3000
Now, your server should be up and running with a mean.js default project! You can view your website by visiting http://mywebsite.com:3000
If you just want your website to run on port 80, the default http port, edit the ‘/server/config/env/all.js’ file and change this line
port: process.env.PORT || 3000,
port: process.env.PORT || 80,