added security features. you need to be logged in before you can access the api (services)
moved ifAuthenticated to common.js - our new place to put garbage.