This is a sample project demonstrating how to integrate the Auth0 Laravel SDK into a Login 3.0 ecosystem. For Laravel 10 applications, the integration steps are identical.
Use Composer to install the dependencies and prepare env variables:
composer install
cp .env.dev .env
Run the application:
php artisan serve --host localhost --port 8000
Open in browser http://localhost:8000
Middleware contains the function to get userinfo and verify JWT. Defined on Userinfo.php
API that defined a /api/userinfo for GET and POST is on api.php
- Route::get('/userinfo'...
- Route::post('/userinfo'...
Contain on Utils.php
getUserInfoUrl
function is to get userinfo URL from .well-known/openid-configurationgetUserInfo
is to get userinfo from userinfo API that related with mysql database
This project is licensed under the MIT license by Auth0. See the LICENSE file for more info.
これは、Auth0 Laravel SDKをLogin 3.0に統合する方法を示すサンプルプロジェクトです。Laravel 10アプリケーションの場合、統合手順は同じです。
Composerを使用して依存関係をインストールし、env変数を準備します:
composer install
cp .env.dev .env
アプリケーションを実行する:
php artisan serve --host localhost --port 8000
ブラウザで開く http://localhost:8000
ミドルウェアには、ユーザー情報を取得し、JWTを検証する機能が含まれている。Userinfo.phpで定義されています。
GETとPOST用の/api/userinfoを定義したAPIはapi.phpにあります。
- Route::get('/userinfo'...
- Route::post('/userinfo'...
Utils.phpに記述。
- getUserInfoUrl`関数は.well-known/openid-configurationからuserinfoのURLを取得する。
- getUserInfo`関数は、mysqlデータベースに関連するuserinfo APIからユーザ情報を取得します。
このプロジェクトのライセンスはAuth0によるMITライセンスです。詳細はLICENSEファイルを参照してください。