I was pleasantly surprised how Meteor makes the developers life so easy. The official documentation for data security is available at http://docs.meteor.com/#dataandsecurity
When building web applications you might want to authorize users before using the application to the fullest extend. By default when you create the meteor application, any changes that happens at client and server will be seen by everyone else. By default, auto publish is enabled. When you go to production, you might not want everyone to see everyone’s changes. You want to authenticate and authorize users. This is standard task in any web applications. You end up coding once and then maintaining the code. Most of the time you create your own user tables and then perform email verification etc., As you can imagine, this is repeated task when developing new application and has clear pattern. Meteor framework team understood this pattern and provided you with easy to use solution. So in my code, with just 5 or 6 line of code, now I am able to provide login using,
- Creating user name and password.
- Creating user id with email and password.
This makes developer life so easy. In the HTML all you have to add the new template provided by Meteor like the following
<div style="float: right; margin-right: 20px;">
Now this alone will not get you going, you need to add the meteor packages for making it work. So in the project terminal, add the following based on your requirement
By default you need to add following for option (1) and (2)
meteor add accounts-base
meteor add accounts-password
meteor add email
meteor add accounts-ui
Once you add all the above four packages, you will get Sign in option show up in the main page like the following
Lets suppose you did add twitter/google/facebook by adding those packages in the console with following command
meteor add accounts-twitter
meteor add accounts-google
meteor add accounts-facebook
then your sign in screen will look like the following
Now, if you you want to authenticate using facebook or twitter, you need to register you all application with those identity providers before you can allow the users to authenticate.
But overall, with few lines of code, I got my user authentication completed and now I can focus on my actual application development.