public function auth(Request $request, $action)
    {
        $provider = strtolower($request->attributes->get('provider'));

        if (! $this->providerExists($provider)) {
            return $this->createNotFoundResponse();
        }

        $service = $this->getServiceByProvider($provider);

        $redirectUri = $service->getAuthorizationUri(['state' => $action]);

        $response = new Response();
        $response->setStatusCode(301);
        $response->headers->set('Location', (string) $redirectUri);
        return $response;
    }
public function auth(Request $request, $action)
    {
        $provider = strtolower($request->attributes->get('provider'));

        if (! $this->providerExists($provider)) {
            return $this->createNotFoundResponse();
        }

        $service = $this->getServiceByProvider($provider);

        $redirectUri = $service->getAuthorizationUri(['state' => $action]);

        $response = new Response();
        $response->setStatusCode(301);
        $response->headers->set('Location', (string) $redirectUri);
        return $response;
    }
public function auth ( Request $ request , $ action ) { $ provider = strtolower ( $ request -> attributes -> get ( 'provider' ) ) ; if ( ! $ this -> providerExists ( $ provider ) ) { return $ this -> createNotFoundResponse ( ) ; } $ service = $ this -> getServiceByProvider ( $ provider ) ; $ redirectUri = $ service -> getAuthorizationUri ( [ 'state' => $ action ] ) ; $ response = new Response ( ) ; $ response -> setStatusCode ( 301 ) ; $ response -> headers -> set ( 'Location' , ( string ) $ redirectUri ) ; return $ response ; }
Authenticate via a separate OAuth provider

@param  Request $request
@param  int     $action  Constant representing either Login or Link account
@return Response
Authenticate via a separate OAuth provider