2

I am new to Zend Framework 2 - Apigility, i created the basic API with the Apigility UI and connected the api with a remote database.

Now i want to create a custom POST route for user login something like: /users/login. What are the steps to create a route like that? Is there any guide?

Thanks in advance!

4

2 回答 2

0

If you want to use Apigility for this kind of thing I'm not sure I would create a custom route.

You should create a whole new RESTful api for this with the route /user/login

Then you can use the create method of the generated resource to generate a login

于 2015-04-01T11:23:25.047 回答
0

My approach would be to create a RESTful endpoint on /user for CRUDing accounts (if necessary) then implement OAuth2 authentication with zf-oauth2. Enrico Zimuel wrote a very good introduction to OAuth2 in Apigility on his blog: http://www.zimuel.it/oauth2-apigility/

I've built something similar to what you're looking for based on ZfcUser and Apigility:

Though those modules are not ready for primetime (that project fell off the rails so they may not even work anymore) you can get a sense of the approach I was taking there.

Those two modules plus LdcOAuth2CryptoToken were a first step towards integrating Satellizer with Apigility.

于 2015-04-01T15:04:53.757 回答