SocialiteProviders / Providers

A Collection of Providers for Laravel Socialite
https://socialiteproviders.com
MIT License
506 stars 445 forks source link

Error: SocialiteProviders\Zitadel\Provider doesn't exist after following installation guide #1294

Open kriosmane opened 1 week ago

kriosmane commented 1 week ago

I'm encountering an issue when trying to integrate the SocialiteProviders/Zitadel package. Despite following the official installation guide step by step, Laravel throws the following error in app/Providers/AppServiceProvider.php:

SocialiteProviders\Zitadel\Provider doesn't exist

I've installed the Installed the package via Composer: composer require socialiteproviders/zitadel

app/Providers/AppServiceProvider.php:

<?php

namespace App\Providers;

use Illuminate\Support\Facades\Vite;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Event;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Register any application services.
     */
    public function register(): void
    {
        //
    }

    /**
     * Bootstrap any application services.
     */
    public function boot(): void
    {
        Vite::prefetch(concurrency: 3);

        Event::listen(function (\SocialiteProviders\Manager\SocialiteWasCalled $event) {
            $event->extendSocialite('zitadel', \SocialiteProviders\Zitadel\Provider::class);
        });

    }
}

boostrap/providers.php:

<?php

return [
    App\Providers\AppServiceProvider::class,
    \SocialiteProviders\Manager\ServiceProvider::class
];

config/services.php:

<?php

return [

    ...
    'zitadel' => [
        'client_id' => env('ZITADEL_CLIENT_ID'),
        'client_secret' => env('ZITADEL_CLIENT_SECRET'),
        'redirect' => env('ZITADEL_REDIRECT_URI'),
        'base_url' => env('ZITADEL_BASE_URL'),
        'organization_id' => env('ZITADEL_ORGANIZATION_ID'),                      // Optional
        'project_id' => env('ZITADEL_PROJECT_ID'),                                // Optional
        'post_logout_redirect_uri' => env('ZITADEL_POST_LOGOUT_REDIRECT_URI')     // Optional
    ],

];

I try to redirect to the Zitadel Provider by :

return Socialite::driver('zitadel')->redirect();

Laravel version: 11.9 PHP Version: 8.2 Socialite version: v5.16.0 socialiteproviders/zitadel: 4.1.0
socialiteproviders/manager: v4.7.0

I cleared the cache using php artisan config:clear and php artisan cache:clear, but the issue persists. I checked that the SocialiteProviders/Zitadel package is installed in the vendor directory.

Is there an additional step or configuration required that is missing from the documentation? Could this be related to the package version or a compatibility issue with Laravel 11?