+ Start a Discussion
mk2013mk2013 

Login Rate exceeded issue

Hi,

I am facing same 'Login Rate Exceeded issue'. Would really appreciate your help on fixing this. I am new to SalesForce and first time doing this integration. I call the 'getConnection' method each time before making API call. Inside that method I check if connection is not null then I return the same connection object or else I create a new one.
I am not sure why I get this error. The method code is like below.

 

Thnaks,

mk2013

 

private EnterpriseConnection getConnection(boolean loginRequired){
		//get all the related properties
		
		String userName = sfdcProps.getProperty("sfdc.username");
		String password = sfdcProps.getProperty("sfdc.password");
			
		logger.warn(" \n\nloginRequired " + loginRequired +" UserName = " +userName + " pwd = " +password );
		
		if(connection != null && !loginRequired) {
			return connection;
		}
		else{
				try {
					 ConnectorConfig config = new ConnectorConfig();
					 config.setUsername(userName);
					 config.setPassword(password);
				 	 //config.setTraceMessage(true);
				 	 //config.setPrettyPrintXml(true);
				     connection = Connector.newConnection(config);
				     if(loginRequired){
				    	 synchronized(connection){
							 LoginResult loginResult = connection.login(userName, password);
							 String sessionId = loginResult.getSessionId(); 
							 String serverUrl = loginResult.getServerUrl();
							 connection.getConfig().setServiceEndpoint(serverUrl);
							 connection.getSessionHeader().setSessionId(sessionId);
				    	 }
				     }
					 String authEndPoint = config.getAuthEndpoint();
				      // display current settings
				      logger.info("SessionId: " + connection.getSessionHeader().getSessionId());
				      logger.info("Auth EndPoint: "+ authEndPoint );
				      logger.info("Service EndPoint: "+ connection.getConfig().getServiceEndpoint());
				      logger.info("Username: "+config.getUsername());
				    }catch (ConnectionException e1) {
					    logger.error("Could not connect to SalesForce: " + e1.getMessage());
				    }
		}
	    return connection;
	}

 

Satish_SFDCSatish_SFDC

Hi,

When you call connector.newConnection(config), it logs you in automatically unless you set manual login to true with the following statement.

config.setManualLogin(true);

 

In your code i see that you called connector.newConnection(config) and then you login again with another statement:

 

LoginResult  loginResult = connection.Login(userName,password);

 

This means there are two logins in the same request and i believe this is the reason why you get the error :"Login Rate Exceeded".

 

Either set manual login to true or do not use the connection.Login(username,password) method.

 

Please let me know if this works.

 

Regards,

Satish Kumar


Please mark my answer as a solution if it was helpful so it is available to others as a proper solution.
If you felt I went above and beyond, please give me Kudos by clicking on the star icon.

 

Satish_SFDCSatish_SFDC
Also found this help link, which talks about the error.

http://help.salesforce.com/apex/HTViewSolution?id=000163453&language=en_US