這是一個 a2workspace/laravel-social-entry 的範例專案。實作了 client 與 admin 兩個使用者的登入功能,並整合了第三方登入與 JWT API 登入。
Here is a demo project for a2workspace/laravel-social-entry and includes multiple user authentication / authorization for App\Models\User and App\Models\Admin.
Clone demo project from github:
git clone https://github.com/A2Workspace/laravel-social-entry-demo.git
cd laravel-social-entry-demo
composer install執行自我安裝命令。該命令會自動設置運行時所需的資料庫環境,請先確定 .env 內的 DATABASE= 設定值是否正確。
php artisan setup最後,運行測試伺服器,並透過瀏覽器打開 http://localhost:8000。
php artisan serve
你可以參考 routes/auth.php 中如何註冊 LaravelJwt 與 SocialEntry 的路由。
其中,透過 assign.guard 中介層的處理,我們可以切換不同的 Auth Guard 來處理與認證使用者帳號,關於 guards 的設定可參考 config/auth.php
