我正在尝试遵循 https://laravel.com/docs/11.x/socialite 和 https://socialiteproviders.com/Saml2/
的说明我已经跑了
composer require laravel/socialite
composer require socialiteproviders/saml2
我的 web.php 包括
use Laravel\Socialite\Facades\Socialite;
Route::get('/auth/redirect', function () {
return Socialite::driver('saml2')->redirect();
});
Route::get('/auth/callback', function () {
$user = Socialite::driver('saml2')->user();
});
但是当我转到 localhost/auth/redirect 时出现错误
Driver [saml2] not supported.
我是不是漏掉了一步?
检查您的
AppServiceProvider
boot
方法是否具有所需的 extendSocialite
调用(此处进行了描述)。您需要在文件中添加 use Illuminate\Support\Facades\Event;
才能正常调用。
之后,检查
config/services.php
文件中的saml2配置。