function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Dave123Dave123 

'Authentication Required' alert when using remoteFunction in S-Control

I'm getting 'Authentication Required' alert when I try to run following S-Control code:

------------------------------------------------------
sforce.connection.remoteFunction({
url : URI,
onSuccess : function(response) {
document.getElementById("result").value = response.textContent;
},
onFailure : function(response) {
document.getElementById("result").value = "Failed " + response;
}
});
}

Output: Failed Error 401: Error reported: 401

------------------------------------------------------
Alert Details:
------------------------------------------------------
Authentication Required

A user name and password are being requested by https://na6.salesforce.com. The site says:
"api.dummy.com"

User Name
Password

OK Cancel
------------------------------------------------------

I've tried following code with Authorization header but that did not work either.

sforce.connection.remoteFunction( {
url : URI,
mimeType: "text/plain",
requestHeaders: {
"Content-Type":"application/x-www-form-urlencoded",
"Authorization" : 'user-pass= ' + username + ':' + pass
},
method: "GET",
async: false, // we really need the auth token to proceed, so wait
onSuccess : function(response) {
document.getElementById("result").value = response.textContent;
},
onFailure : function(response) {
document.getElementById("result").value = "Failed " + response;
}
});
}

------------------------------------------------------

Please let me know how can I avoid this username/password alert.
shillyershillyer

Are you sure "Authorization" is a parameter for this call? I don't see it in the docs.

 

Did you setup your remote site?

 

Best,

Sati

DowithforceDowithforce

Hello Dave,

 

are you able to solve ajax toolkit problem?

 

looking forward...

 

Thanks

Message Edited by Dowithforce on 11-17-2009 11:03 PM