Best laravel framework open-source packages.

Laravel passport oauth2

Laravel OAuth2 Server/Client Example.
Updated 9 months ago

Laravel Passport Oauth2

PHP8.1+ required.

Getting Started

git clone https://github.com/RayYH/laravel-passport-oauth2.git
cd laravel-passport-oauth2/

Server setup

cd server
composer install
cp .env.example .env
touch database/database.sqlite
npm install
npm run build
php artisan migrate
php artisan key:generate

php artisan passport:install --force
php artisan passport:client

 Which user ID should the client be assigned to? (Optional):
 > 

 What should we name the client?:
 > third party

 Where should we redirect the request after authorization? [http://localhost/auth/callback]:
 > http://localhost:8001/callback

New client created successfully.
Client ID: 999d05e1-80d9-404a-af45-10acdb9927c2
Client secret: MJGYZGtOgjFr98bdr1XkNImHJH3WtSPD8iF3JbPy

php artisan serve --port 8000

Client setup

cd client
composer install
php artisan key:generate
cp .env.example .env

# Edit .env
# OAUTH_CLIENT_ID=999d05e1-80d9-404a-af45-10acdb9927c2
# OAUTH_CLIENT_SECRET=MJGYZGtOgjFr98bdr1XkNImHJH3WtSPD8iF3JbPy

php artisan serve --port 8001

Usage

visit http://localhost:8001, click Login use ThirdApp account., then enter the email (admin@test.com) and password (admin) to login, it will redirect to the client after logged.

Tags passport