Yeah API/REST Auth is a little tricky. At the moment I'm checking the extension of the request (.json) in AppController::beforeFilter(), then switching the Auth type to Basic and then attempting $this->Auth->login().
When it's basic, the user/pass comes in via http://user:[email protected]/ and authenticated on every request. Other guys from the team generate a token, and in the beforeFilter() see if that token matches up a user record. If so manually login the user. Lastly, when I get a bit of time I'm going to look at this: https://github.com/nodesagency/Platform-API-plugin Hope that helps dude. On Mon, Aug 13, 2012 at 4:40 PM, 42startups <[email protected]> wrote: > Simon! Yep it's me :) > > I worked out I didn't include the RequestHandler component. > > Second issue was formatting the POST data. Was trying to post raw json to > /users.json using a chrome plugin. Didn't work, but a simple form did so > long as the input name is in the format data[User][username] > > Got to workout API authentication now. Any pointers? > > > On Mon, Aug 13, 2012 at 3:46 PM, Simon Males <[email protected]> wrote: >> >> Yo Nathan ? :) >> >> See first if you can make sense out of the below first. Shows your how >> to return Json/Xml views. >> >> http://book.cakephp.org/2.0/en/views/json-and-xml-views.html >> >> Handling a JSON POST request is the same as handling a HTTP POST. >> >> On Mon, Aug 13, 2012 at 3:11 PM, 42startups <[email protected]> wrote: >> > Hi >> > >> > I'm looking for an up-to-date tutorial on creating a REST API using Cake >> > so >> > that I can send a POST request to create a new User and also a GET >> > request >> > to fetch and authenticate a User's username and password. >> > >> > I've found a few online, but they seem to be from the 1.3 Cake version. >> > And >> > the Cookbook instructions don't seem to work for me. >> > >> > Cheers >> > >> > -- >> > You received this message because you are subscribed to the Google >> > Groups >> > "CakePHP" group. >> > To post to this group, send email to [email protected]. >> > To unsubscribe from this group, send email to >> > [email protected]. >> > Visit this group at http://groups.google.com/group/cake-php?hl=en-US. >> > >> > >> >> >> >> -- >> Simon Males >> >> -- >> You received this message because you are subscribed to the Google Groups >> "CakePHP" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> Visit this group at http://groups.google.com/group/cake-php?hl=en-US. >> >> > > -- > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > Visit this group at http://groups.google.com/group/cake-php?hl=en-US. > > -- Simon Males -- You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
