简体   繁体   中英

How to add service entry for azure in Laravel

I want to add microsoft azure as an authentication method. I have followed laravel's and socialites documentation to add other methods than provided by laravel.

I have followed all the steps but I keep getting the error:

"SocialiteProviders \ Manager \ Exception \ MissingConfigException
There is no services entry for azure"

app.php:

'providers' => [
    /*
     * Laravel Framework Service Providers...
     */
    // Some more providers

    \SocialiteProviders\Manager\ServiceProvider::class,

],

'aliases' => [
    'Socialite' => Laravel\Socialite\Facades\Socialite::class,

],

EventServiceProvider.php:

    protected $listen = [
    Registered::class => [
        SendEmailVerificationNotification::class,
    ],
    \SocialiteProviders\Manager\SocialiteWasCalled::class => [
        'SocialiteProviders\\Azure\\AzureExtendSocialite@handle',
    ],

];

services.php:

'azure' => [
    'client_id' => 'MY_ID',
    'client_secret' => 'MY_SECRET',
    'redirect' => 'http://localhost:8000/login/azure/callback',
],

Login Controller:

public function redirectToProvider()
{
    return Socialite::with('azure')->redirect();
}

/**
 * Obtain the user information from GitHub.
 *
 * @return \Illuminate\Http\Response
 */
public function handleProviderCallback()
{
    $user = Socialite::with('azure')->user();

    // $user->token;
}

I can not find anything about this problem on the internet. It seems like it's not reading the "azure" entry in services.php, but I have no idea how to fix it.

EDIT: Yes I have installed everything with composer.

So far I can see, is this an issue with your config caching. Here for you have to run php artisan config:clear , this will remove the caching of the config.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM