While working internally with Laravel APIs and Vue.js, decided to create a sample open-source project to show how it all works together.
Here’s the repository: https://github.com/LaravelDaily/Laravel-Passport-API-Server-Client-Demo
There are two mini-projects inside of it:
- Laravel 5.5 Passport-based Server project with database
- Laravel 5.5 and Vue.js based Client project to connect to that Server and get the data
Readme contains quite simple installation instructions, and if it all works for you, you should see log in form and then authorization screen:
When authorized, you will get to the Projects list – basically, HTML table with data filled in by Vue.js calling Server’s API.
Here’s how it looks in the server’s database.
For client, we don’t even need the database – all the data is taken/manipulated on the server.
The goal of this project is to show you a simple mechanism how it all works, but you can adapt it to your needs, add different CRUDs and API calls instead of our demo Projects.
We hope it’s a useful starter tool to speed up your development process!
Link to the repository again: https://github.com/LaravelDaily/Laravel-Passport-API-Server-Client-Demo
Hi, the repository is empty.
Crap, git failed with subfolders. Thanks for the notice, will reupload in an hour, when back to computer after lunch.
Fixed now, uploaded files.
perfect.. thanks!
Hi thanks for providing the passport tutorial. I followed the steps, but I am facing 401 error.
GuzzleHttp \ Exception \ ClientException (401)
Client error: `POST http://passport-server.dev/oauth/token` resulted in a `401 Unauthorized` response: {“error”:”invalid_client”,”message”:”Client authentication failed”}
Same raised in Github.
How to fix this issue?
Help appreciated.
check client secret
I am starting to learn vue. Very helpful.
Hi.
Try
“`
http://passport-server.test/callback
“`
and
“`
http://passport-server.test/auth/callback
“`
But all times get
>http://passport-server.test/callback?code=def50200f92….06517f2
>Sorry, the page you are looking for could not be found.
Apreciate some help
Using web-routes? Why?