append(':') ->append(AllowExternalProfileManagement::class) ->__toString(); $this->middleware(EnabledOnlyOnLocalhost::class); $this->middleware($isExternalProfileManagementAllowed); } /** * This will redirect the user to the appropriate auth service. * * @return RedirectResponse|JsonResponse */ 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 !== null) { return Redirect::to($link); } } return new JsonResponse([ 'error' => 'invalid site', ], 400); } }