Base repository to create an Oauth2 server, it is written in Laravel with Passport component and it is consume them by self with login proxy.
- Go to project root folder and run
composer install
- Configure DB Connection in
.env
file - Run migrations
php artisan migrate
- Install passport component
php artisan passport:install
- Save clients secrets. You will see something like this:
Encryption keys generated successfully.
Personal access client created successfully.
Client ID: 1
Client Secret: CLIENT_SECRET_1
Password grant client created successfully.
Client ID: 2
Client Secret: CLIENT_SECRET_2
- Configure
.env
file with password client:
PASSWORD_CLIENT_ID=2
PASSWORD_CLIENT_SECRET=CLIENT_SECRET_2
- If you are deploying Passport to your production servers for the first time, you will likely need to run the
passport:keys
command.
php artisan passport:keys
Also you can visit the official documentation here
- You can configure expiration time of a token and also the refresh token in
boot
method of:
app/Providers/AuthServiceProvider.php
- To verify the available routes, run:
php artisan route:list