public function getUserInfo(array $params)
    {
        $this->logger->debug('Get User Info.');
        if (array_key_exists("error", $params)) {
            $this->logger->error(
                $params["error"].array_key_exists("error_description", $params) ? $params["error_description"] : ''
            );
            throw new Exception('FranceConnect error => '.$params["error"]);
        }
        
        $this->verifyState($params['state']);
        $accessToken = $this->getAccessToken($params['code']);
        $userInfo = $this->getInfos($accessToken);
        $userInfo['access_token'] = $accessToken;
        
        $token = new FranceConnectToken($userInfo,
            [
                FranceConnectAuthenticatedVoter::IS_FRANCE_CONNECT_AUTHENTICATED,
                AuthenticatedVoter::IS_AUTHENTICATED_ANONYMOUSLY,
            ]
        );
        $request = $this->requestStack->getCurrentRequest();
        
        if (null !== $request) {
            $this->sessionStrategy->onAuthentication($request, $token);
        }
        
        $this->tokenStorage->setToken($token);
        foreach ($this->providersKeys as $key) {
            $this->session->set('_security_'.$key, serialize($token));
        }
        
        
        return json_encode($userInfo, true);
    }
public function getUserInfo(array $params)
    {
        $this->logger->debug('Get User Info.');
        if (array_key_exists("error", $params)) {
            $this->logger->error(
                $params["error"].array_key_exists("error_description", $params) ? $params["error_description"] : ''
            );
            throw new Exception('FranceConnect error => '.$params["error"]);
        }
        
        $this->verifyState($params['state']);
        $accessToken = $this->getAccessToken($params['code']);
        $userInfo = $this->getInfos($accessToken);
        $userInfo['access_token'] = $accessToken;
        
        $token = new FranceConnectToken($userInfo,
            [
                FranceConnectAuthenticatedVoter::IS_FRANCE_CONNECT_AUTHENTICATED,
                AuthenticatedVoter::IS_AUTHENTICATED_ANONYMOUSLY,
            ]
        );
        $request = $this->requestStack->getCurrentRequest();
        
        if (null !== $request) {
            $this->sessionStrategy->onAuthentication($request, $token);
        }
        
        $this->tokenStorage->setToken($token);
        foreach ($this->providersKeys as $key) {
            $this->session->set('_security_'.$key, serialize($token));
        }
        
        
        return json_encode($userInfo, true);
    }
public function getUserInfo ( array $ params ) { $ this -> logger -> debug ( 'Get User Info.' ) ; if ( array_key_exists ( "error" , $ params ) ) { $ this -> logger -> error ( $ params [ "error" ] . array_key_exists ( "error_description" , $ params ) ? $ params [ "error_description" ] : '' ) ; throw new Exception ( 'FranceConnect error => ' . $ params [ "error" ] ) ; } $ this -> verifyState ( $ params [ 'state' ] ) ; $ accessToken = $ this -> getAccessToken ( $ params [ 'code' ] ) ; $ userInfo = $ this -> getInfos ( $ accessToken ) ; $ userInfo [ 'access_token' ] = $ accessToken ; $ token = new FranceConnectToken ( $ userInfo , [ FranceConnectAuthenticatedVoter :: IS_FRANCE_CONNECT_AUTHENTICATED , AuthenticatedVoter :: IS_AUTHENTICATED_ANONYMOUSLY , ] ) ; $ request = $ this -> requestStack -> getCurrentRequest ( ) ; if ( null !== $ request ) { $ this -> sessionStrategy -> onAuthentication ( $ request , $ token ) ; } $ this -> tokenStorage -> setToken ( $ token ) ; foreach ( $ this -> providersKeys as $ key ) { $ this -> session -> set ( '_security_' . $ key , serialize ( $ token ) ) ; } return json_encode ( $ userInfo , true ) ; }
Returns data provided by FranceConnect.

@param array $params query string parameter

@return string data provided by FranceConnect (json)
@throws Exception General exception
@throws SecurityException An exception may be thrown if a security check has failed
Returns data provided by FranceConnect .