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


Hi All,

    i wrote this class for integration of Mailchimp with salesforce using apis


public class MailchimpOauth{public void invokeExternalWs(){Http h = new Http();   HttpRequest req = new HttpRequest();               //req.setHeader('Host','');      req.setBody('');   req.setBody('');   req.setBody('');   req.setBody('');
    req.setHeader('Connection','keep-alive');    req.setHeader('Content-Type', 'application/atom+xml');    req.setMethod('POST');    req.setEndpoint('');

     HttpResponse res = h.send(req);      system.debug(res.getbody());


But i got a response like  Status=Bad Request, StatusCode=400 &&&&&error=invalid_client_id&error_description=client%20identifier%20invalid.How to fix this.

any one can u please rectify this.can u give me the solution for fixing that.calient id given in that one is valid.But i dont know how the response coming like this.


Thanks in advance.




Better late than never ...


Everytime I get this error, it always has to do with a key and secret mishap. In one case, I specified the wrong key and secret pair values. In another case, I had misnamed the environment variables that my Ruby/Rails app expected.

any one got update on this issue.
Santosh Chakrapani 10Santosh Chakrapani 10
Ensure that your scope matches too.

var oauth2 = new sf.OAuth2({
  // you can change loginUrl to connect to sandbox or prerelease env.
  loginUrl : '',
  clientId : '3NMX9Y6d_Btp4xp65mgKj_qNxAWSQ_KEF4kB1zO_PiRlArfx7u6S7cnGaP656VUElUPCbZjiLYRnhIweXm7Xk',
  clientSecret : '9100313977392224422',
  redirectUri : 'http://localhost:3000/oauth2/callback'

app.get('/oauth2/auth', function(req, res) {
  res.redirect(oauth2.getAuthorizationUrl({ scope : 'full' }));

clientId, clientSecret, redirectUri and scope must match to whats there under Connected App in your Salesforce environment

rohit kumarrohit kumar
great...the login URL is
s shekar 28s shekar 28
I also faced the same error,to reslove this give password+security token .
Then you will not get this error .

if this helps you choose this as the best answer

vaibhav dhawalevaibhav dhawale
Guys, Please check your firstname, lastname, and the security token is corrrect 

Try to check the error message in the URL, it is more descriptive. For me it was scope issue.