Search code examples
meteoriron-routeruser-accounts

Meteor Js limiting access to my meteor app


I have a meteor app and I want to host it, but I only want a few people to login to it and have access to it, at most 5 people. How Do I accomplish that?


Solution

  • You can create 5 accounts like these:

     Meteor.startup(function () {
       if (Meteor.users.find().count() === 0) {
         Accounts.createUser({
            username: 'xxxxx',
            email: 'xxxx@xxxx.xx',
            password: 'xxxxxxx',
            profile: {}
         });
        ...
       }
     });
    

    And avoid possiblity to create new user:

    AccountsTemplates.configure({
         forbidClientAccountCreation: true,
     });