append(':') ->append(AllowExternalProfileManagement::class) ->__toString(); $this->middleware(EnabledOnlyOnLocalhost::class); $this->middleware($isExternalProfileManagementAllowed); } /** * This will redirect the user to the appropriate auth service. */ public function index(Request $request): RedirectResponse|JsonResponse { $site = Arr::get($request->all(), ExternalProfile::ATTRIBUTE_SITE); $profileSite = ExternalProfileSite::fromLocalizedName($site); if ($profileSite instanceof ExternalProfileSite) { $link = $profileSite->getAuthorizeUrl(); if ($link instanceof Uri) { $link->redirect(); } } return new JsonResponse([ 'error' => 'invalid site', ], 400); } }