Last updated 4 years ago
Add admin users in /database/config.php
/database/config.php
token will be auto generated
Add /auth route in index.php
index.php
Make sure to import Auth Class use Auth;
Make sure to import Auth Class
use Auth;
POST -/auth
POST
-/auth
username
string
username of admin
password
password of admin
{ "admins": [ { "username": "admin1", "password": "admin1", "token": "" }, { "username": "admin2", "password": "admin2", "token": "" } }
/** * Authentication Route */ $router->post('/auth',function($payload){ echo Auth::login($payload); });
{ "status": 200, "message": "Token generated.", "data": { "token": "NDFjMjhkMjZkYmRiZGJiMTE4NDZiYTZkODQ4NDcwMzI1NzdiYzJjNjI5Y2Q3MmNmYmYxNGE0YWUyOWU1Njg1ZjU4ZWYzNWM3OWY3NTE0N2FmYzQ0MjM4MGZkNTE0NjRjNzlkNzJiODFhM2RkMjBjMzBhMWM4MWVhNWIxY2U5OWRmMDYxNmIwODdhZDI1Y2EzYTM0N2ExYTAzNzBlNGJlNzBiMTMyMDNjMjZiNTljNGNhNDQwOTBiNDAzMTg0YzU3N2I3MDIzZDg=" } }