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.
|test if you are authenticated
|get current authenticated user
|fetch all articles
|create new article
|get currently authenticated user single article
|get single article
Property Data Login email, Password register name,email,type,password,password_confirmation article title,body,author
Privileges (User Type)
Role Privilege Name 0 view post only Member 1 create,view,edit Admin 2 create,view,edit,delete Super Admin
Error Handling and Response type
Code Status Description 200 Ok The request was successfully completed 201 Created A new resource was successfully created 400 Bad Request The request was invalid 401 Unauthorized Invalid login credentials 403 Forbidden You do not have enough permission to perform this action 404 Not found The requested resource/page not found 405 Method Not Allowed The request is not supported by the resource/ method 409 Conflict The request could not be completed due to conflict 500 Internal Server Error The request was not completed due to an internal error on the server side 503 Service Unavailable The server was unavailable Return Type: JSON
Method Type Access-Control-Allow-Methods GET, POST, PUT, DELETE, OPTIONS Access-Control-Allow-Headers X-Requested-With, Content-Type, XToken-Auth, Authorization
How it works
- Register/login via the endpoint
- Upon successful login/registration, copy the token and paste in your header
- update your profile to admin/super admin to update and delete article.
Pictorial Example with Postman
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.