Skip to content

antwigambrah/laravel-api-starter

Repository files navigation

Rest Api with Laravel(5.5)

An oauth2 rest api starter

Want to Build Upon It ?

First, clone the repo:

$ git clone git@github.com:antwigambrah/laravel-api-starter.git

Install dependencies

$ cd laravel-api-starter
$ composer install

Configure environment in the .env file

Run the Artisan migrate

$ php artisan migrate 

Create passport oauth2 personal clients to generate access tokens

Personal Access Tokens)

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.

Api routes

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

Create new User Account

userregister

Generate access token

loginaccesstoken

Access authenticated user with token

userdata

License

MIT license