private function createAccessToken($email, $password, $clientConfig)
    {
        $oauth2Config = $clientConfig['oauth2'];
        if (!array_key_exists('client_id', $oauth2Config)) {
            throw new Exception('Cannot create new oauth token without client id');
        }

        $mergedConfig = array_merge($this->clientConfig, $clientConfig, [
            'headers' => [
                'User-Agent' => "RIPS-API-Connector/{$this->version}",
            ],
            RequestOptions::JSON => [
                'grant_type' => 'password',
                'client_id' => $oauth2Config['client_id'],
                'username' => $email,
                'password' => $password
            ]
        ]);

        $request = new AccessTokenRequest(new Client($mergedConfig));
        $tokens = $request->getTokens()->getDecodedData();

        if (isset($oauth2Config['store_token']) && $oauth2Config['store_token'] === true) {
            if (!array_key_exists('token_file_path', $oauth2Config) || empty($oauth2Config['token_file_path'])) {
                throw new Exception('Token path is needed to store token');
            }
            $filePath = $oauth2Config['token_file_path'];
            file_put_contents($filePath, json_encode($tokens));
        }

        return $tokens->access_token;
    }