title: CakePHP Authentication on REST API
body: <p>So I'm creating a REST API for a web app I'm developing, and I know the basic ways for authentication are either sending the credentials on each request or sending a token.</p>
  
  <p>Since I have never used token before, I think I may send the credentials for each request. The point is I can't find any examples on how to handle this in the controller. Would it be something like this?</p>
  
  <pre><code>public function api_index() {
      if(!$this-&gt;Auth-&gt;login()) return;
  
      $this-&gt;set(array(
          'models' =&gt; $this-&gt;Model-&gt;find('all'),
          '_serialize' =&gt; array('models')
      ));
  }
  </code></pre>
  
  <p>I don't really think this is the way <code>AuthComponent::login()</code> works, can I get some directions here please?</p>