F
F
fman22019-11-16 18:16:31
Laravel
fman2, 2019-11-16 18:16:31

Factory for laravel/socialite?

Friends, hello everyone. I have a problem.
Providers for socialite are configured via config files in PHP, which doesn't work for me. Depending on the user's settings, the keys and links for the redirect change.
Is there some kind of factory where I can pass the name of the provider, its parameters and get the finished object? I didn’t find it in the documentation, but I haven’t read the code yet. Now I'll do it, but maybe someone already knows the answer?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
fman2, 2019-11-16
@fman2

The logic is like this. I think the meaning is clear. It turned out that everything is not so difficult, it is strange that this is not normally described in the docks.

use Laravel\Socialite\SocialiteManager; 
    use SocialiteProviders\VKontakte\Provider;

    public function instance(SocialiteManager $manager)
    {
            return $manager->buildProvider(Provider::class, [
                    'client_id' => 123,
                    'client_secret' => 123,
                    'redirect' => 'https://localhost/test/test'
        ]);
    }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question