+ Start a Discussion
Siddharth Birari.ax1164Siddharth Birari.ax1164 

Login Error : Ajax Toolkit

Hi,

 

I have a trouble while using Ajax Toolkit in my javascript.

 

My desire is to connect to another salesforce org from the currently logged in org.

 

for this, below is the javascript code that i am making use of

<script src="../../soap/ajax/25.0/connection.js" type="text/javascript"></script>

<script type="text/javascript">
window.onload = synchronousCall;
function synchronousCall(){
	try{
		var result = sforce.connection.login("username","**password***securitytoken***");
		alert(sforce.connection.serverUrl);
		alert(result.sessionId);	
	}
	catch(error){
		alert(error);
	}
}

 This code works absolutely fine, when the salesforce instance of currently logged in org is same as that of the org which is required to be connected.

 

But it gives the following exception, when the instances are different.

 

{faultcode:'sf:INVALID_LOGIN', faultstring:'INVALID_LOGIN: Invalid username, password, security token; or user locked out.', detail:{LoginFault:{exceptionCode:'INVALID_LOGIN', exceptionMessage:'Invalid username, password, security token; or user locked out.', }, }, }

 

Please let me know if i am missing something.

 

Anticipating your help

Thanks in advance

 

 

S91084S91084

Have you tried setting up the sforce.connection.sessionis = "{$Api.Session_ID}";

turbo2ohturbo2oh
were you ever able to solve this?