FuelPHP Bin
In terminal 1. In terminal, composer require barryvdh/laravel-cors:0.2.x 2. In terminal, php artisan config:publish barryvdh/laravel-cors 3. update the following inside app/config/packages/barryvdh/laravel-cors/config.php 'defaults' => array( 'supportsCredentials' => false, 'allowedOrigins' => array(), 'allowedHeaders' => array(), 'allowedMethods' => array(), 'exposedHeaders' => array(), 'maxAge' => 0, 'hosts' => array(), ), 'paths' => array( 'api/v1/*' => array( 'allowedOrigins' => array('*'), 'allowedHeaders' => array('*'), 'allowedMethods' => array('*'), 'maxAge' => 3600, ) ) Install jwt for laravel 4.1 5. in termial, composer require tymon/jwt-auth:0.4.* 6. in terminal, php artisan config:publish tymon/jwt-auth 7. updated routes.php, check JWT START and JWT END comments for new code 8. created UsersController.php (you can create your own based on usage) In config/auth.php, update the ff. 9. 'model' => 'User' to 'model' => 'VicidialUser' 10. 'table' => 'users' to 'table' => 'vicidial_users' In config/packages/tymon/jwt-auth/config.php, update the ff. 11. 'user' => 'User' to 'user' => 'VicidialUser' 12. 'identifier' => 'id' to 'identifier' => 'user_id' In config/app.php, add the ff. Under providers array 13. Tymon\JWTAuth\Providers\JWTAuthServiceProvider::class, Under alias array, 14. 'JWTAuth' => 'Tymon\JWTAuth\Facades\JWTAuth', 15. 'JWTFactory' => 'Tymon\JWTAuth\Facades\JWTFactory::class', Then add `loginToken` field in vicidial_users 16. php artisan migrate Generate JWT secret 17. php artisan jwt:generate ========= TESTING =========== Admin Login sample | http://localhost:8000/admin/login 1. https://monosnap.com/file/1RHL6MBicLQs2WCtljbTVl1KxS6Z2D Get Admin details with required token | http://localhost:8000/api/v1/admin_details?token=TOKENHERE 2. https://monosnap.com/file/2et5z3ssSEPh0QaCzbBPu8UCvAOXJX ========= ERRORS =========== 1. Failed Login { "error": true, "message": "Failed to login, please try again." } 2. Expired | Invalid Token { "error": true, "message": "Invalid Token" } ========= MORE DETAILS =========== jwt-auth/config.php | 'ttl' => 60 1. Token Expiration = 60 mins 2. Reference: http://ryan-wong.github.io/2015/04/15/how-to-setup-jwt-authentication-laravel/, please take note that this not complete and some are wrong.