title: Multiple models in passport.js
body: <p>I have two types of account on my website:</p>
  
  <p>Admin and User.</p>
  
  <p>The admin will access to the administration portal and will use credentials and passport.js to authenticate.</p>
  
  <p>The user will access to his account. He could list the products ... He will not have access to the admin portal but to the front.</p>
  
  <p>So to summarize the admin account can add products, descriptions, manage stocks and the user will have an account to buy the products (ecommerce).</p>
  
  <p>Now my question is that the authentication protocol is the same but my models are different.</p>
  
  <p>So what is the best way to allow passport.js to authenticate my two accounts?</p>
  
  <p>I need to pass the model to passport.js.</p>
  
  <p>The solutions I am thinking about are:</p>
  
  <ol>
  <li><p>Have a user base model and inherit the base model in my Admin and User models. But I do not know how to do this.</p></li>
  <li><p>Pass the model type I will use to passport.js. But how to do that?</p></li>
  <li><p>Create an independent authentication system for every models. But it will complicate the code to do exactly the same things. Duplication and I hate this. :)</p></li>
  </ol>
  
  <p>If you have other ideas or best practices and can help I would really appreciate.</p>
  
  <p>Thanks,</p>