public function getAuthorizeUri(Provider $provider, $userId, $scope, $redirectUri)
    {
        $queryParameters = [
            'client_id' => $provider->getClientId(),
            'redirect_uri' => $redirectUri,
            'scope' => $scope,
            'state' => $this->random->getHex(16),
            'response_type' => 'code',
        ];

        $authorizeUri = \sprintf(
            '%s%s%s',
            $provider->getAuthorizationEndpoint(),
            false === \strpos($provider->getAuthorizationEndpoint(), '?') ? '?' : '&',
            \http_build_query($queryParameters, '&')
        );
        $this->session->set(
            '_oauth2_session',
            \array_merge(
                $queryParameters,
                [
                    'user_id' => $userId,
                    'provider_id' => $provider->getProviderId(),
                ]
            )
        );

        return $authorizeUri;
    }
public function getAuthorizeUri(Provider $provider, $userId, $scope, $redirectUri)
    {
        $queryParameters = [
            'client_id' => $provider->getClientId(),
            'redirect_uri' => $redirectUri,
            'scope' => $scope,
            'state' => $this->random->getHex(16),
            'response_type' => 'code',
        ];

        $authorizeUri = \sprintf(
            '%s%s%s',
            $provider->getAuthorizationEndpoint(),
            false === \strpos($provider->getAuthorizationEndpoint(), '?') ? '?' : '&',
            \http_build_query($queryParameters, '&')
        );
        $this->session->set(
            '_oauth2_session',
            \array_merge(
                $queryParameters,
                [
                    'user_id' => $userId,
                    'provider_id' => $provider->getProviderId(),
                ]
            )
        );

        return $authorizeUri;
    }
public function getAuthorizeUri ( Provider $ provider , $ userId , $ scope , $ redirectUri ) { $ queryParameters = [ 'client_id' => $ provider -> getClientId ( ) , 'redirect_uri' => $ redirectUri , 'scope' => $ scope , 'state' => $ this -> random -> getHex ( 16 ) , 'response_type' => 'code' , ] ; $ authorizeUri = \ sprintf ( '%s%s%s' , $ provider -> getAuthorizationEndpoint ( ) , false === \ strpos ( $ provider -> getAuthorizationEndpoint ( ) , '?' ) ? '?' : '&' , \ http_build_query ( $ queryParameters , '&' ) ) ; $ this -> session -> set ( '_oauth2_session' , \ array_merge ( $ queryParameters , [ 'user_id' => $ userId , 'provider_id' => $ provider -> getProviderId ( ) , ] ) ) ; return $ authorizeUri ; }
Obtain an authorization request URL to start the authorization process
at the OAuth provider.

@param Provider $provider
@param string   $userId
@param string   $scope       the space separated scope tokens
@param string   $redirectUri the URL registered at the OAuth provider, to
be redirected back to

@return string the authorization request URL

@see https://tools.ietf.org/html/rfc6749#section-3.3
@see https://tools.ietf.org/html/rfc6749#section-3.1.2
Obtain an authorization request URL to start the authorization process at the OAuth provider .