My Laravel Passport REST Api Demo Application

My Laravel Passport REST Api Demo Application

Laravel Passport Api 

This a demo rest api project using Laravel framework.

Laravel Passport provides a full OAuth2 server implementation for your Laravel application in a matter of minutes. Passport is built on top of the League OAuth2 server that is maintained by Andy Millington and Simon Hamp.

User Authentication

POST user
GET if you are authenticated
GET current  authenticated user
POST user


GET all articles
POST new article
GET{id}get currently authenticated user single article 
GET{id}get single article
PUT api/articles/{id} update article
DELETE{id}delete article

Form Data

Loginemail, Password

Privileges (User Type)

0view post onlyMember
2create,view,edit,deleteSuper Admin

Error Handling and Response type

200OkThe request was successfully completed
201CreatedA new resource was successfully created
400Bad RequestThe request was invalid
401UnauthorizedInvalid login credentials
403ForbiddenYou do not have enough permission to perform this action
404Not foundThe requested resource/page not found
405Method Not AllowedThe request is not supported by the resource/ method
409ConflictThe request could not be completed due to conflict
500Internal Server ErrorThe request was not completed due to an internal error on the server side
503Service UnavailableThe server was unavailable
Return Type: JSON


Access-Control-Allow-MethodsGET, POST, PUT, DELETE, OPTIONS
Access-Control-Allow-HeadersX-Requested-With, Content-Type, XToken-Auth, Authorization

How it works

  1. Register/login via the endpoint 
  2. Upon successful login/registration, copy the token and paste in your header 
  3. update your profile to admin/super admin to update and delete article.

Pictorial Example with Postman 



test if you are authenticated


get all articles


get single article
edit article


get authenticated user

To get Familiar with the process here is an example implementation method for this API.



Enjoy this article ? drop a comment below and add your own contribution.

Maye Jacob

Jacob Olorunmaye

Verified Expert
Passionate Backend Developer | Expert in PHP, Laravel, JavaScript, and Golang 🚀 | Crafting seamless, scalable solutions for the digital era

Leave a Reply

Your email address will not be published. Required fields are marked *