Rest Api with Laravel(5.5)
An oauth2 rest api starter
First, clone the repo:
$ git clone git@github.com:antwigambrah/laravel-api-starter.git
$ cd laravel-api-starter
$ composer install
Run the Artisan migrate
$ php artisan migrate
To create both personal access clients and password access clients
$ php artisan passport:install
or
To create password access clients
$ php artisan passport:client --password
N:B The Grant type for the oauth2 implementation is Resource owner credentials grant(Password grant) which allows your application(client) to create tokens for authenticated users after every login.This is mostly suitable when API may be consumed by your web application, mobile applications etc where a user token is issued after user is authenticated as in jwts.
HTTP Method | Path | Action | Desciption |
---|---|---|---|
POST | /api/v1/auth/register | register | Register a new account |
POST | /api/v1/auth/login | login | Login |
GET | /api/user | getUserDetails | Fetch authenticated user |