Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zerossb/laravel-oauth
https://github.com/zerossb/laravel-oauth
Last synced: 8 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/zerossb/laravel-oauth
- Owner: zerossB
- Created: 2021-03-30T16:50:41.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2021-03-30T18:02:44.000Z (almost 4 years ago)
- Last Synced: 2024-11-07T15:53:33.285Z (about 2 months ago)
- Language: PHP
- Size: 330 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## About Project
An example of using oauth with laravel and passport.## How to run the project
```bash
$ docker-compose up
```### First steps
After running the project, run the command below to install the passport.
```bash
$ docker-compose exec server php artisan passport:install
```Now we are going to create our key pair for the client.
```bash
$ docker-compose exec server php artisan passport:clientWhich user ID should the client be assigned to?:
>What should we name the client?:
> Laravel Client AppWhere should we redirect the request after authorization? [http://localhost/auth/callback]:
> http://localhost:8001/auth/callbackNew client created successfully.
Client ID:
Client secret:
```Copy the CLIENT_ID and CLIENT_SECRET and paste it into the `.env` of the `client` application
```dosini
DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=oauth_laravel_client
DB_USERNAME=oauth_laravel_client
DB_PASSWORD=oauth_laravel_clientCLIENT_ID=
CLIENT_SECRET=
REDIRECT_URL=http://localhost:8001/auth/callback
API_URL=http://localhost:8000/api/
```And paste this in the `.env` on the `server`
```dosini
DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=oauth_laravel_server
DB_USERNAME=oauth_laravel_server
DB_PASSWORD=oauth_laravel_server
```Now open your browser and access the url [http://localhost:8001/](http://localhost:8001/) which is the client
## and good fun!