i @thebigk
Have you checked the Subdomain Routing documentation?
Route::domain('{account}.example.com')->group(function () {
Route::get('user/{id}', function (string $account, string $id) {
// ...
});
});
Then you can change your app/Providers/RouteServiceProvider.php to load different route files for each subdomain
Route::domain('subdomain.' . env('APP_URL'))
->middleware('web')
->namespace($this->namespace)
->group(base_path('routes/subdomain.php'));
Remember that you need to setup all your callbacks in the social platform. So if you are using Google you need to fill all the URI authorized callbacks. I don't know about LinkedIn, but Google doesn't allow wildcard URIs, so you can't add something like https://*.mydomain.com/callback
If you are worried about how to give Socialite a different URL for each callback depending on your subdomain, you can use the setConfig($config) option when you do the redirect
$clientId = "secret";
$clientSecret = "secret";
$subdomain = Route::getCurrentRoute()->subdomain;
$redirectUrl = "http://".$subdomain.".yourdomain.com/api/redirect";
$additionalProviderConfig = ['site' => 'meta.stackoverflow.com'];
$config = new \SocialiteProviders\Manager\Config($clientId, $clientSecret, $redirectUrl, $additionalProviderConfig);
return Socialite::driver('google')->setConfig($config)->redirect();