You need to sign in to do that
Don't have an account?
Dave123
'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.
------------------------------------------------------
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.
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
Hello Dave,
are you able to solve ajax toolkit problem?
looking forward...
Thanks