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
anu123anu123 

error=invalid_client_id&error_description=client%20identifier%20invalid

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','https://oauth.constantcontact.com/ws/oauth/request_token');      req.setBody('https://login.mailchimp.com/oauth2/authorize');   req.setBody('https://login.mailchimp.com/oauth2/token');   req.setBody('https://login.mailchimp.com/oauth2/');   req.setBody('https://login.mailchimp.com/oauth2/metadata');
    req.setHeader('Connection','keep-alive');    req.setHeader('Content-Type', 'application/atom+xml');    req.setMethod('POST');    req.setEndpoint('https://login.salesforce.com/services/oauth2/authorize?response_type=code&client_id=957533735502&redirect_uri=http://localhost/oauth/complete.php');

     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.

anu

 

sbob909sbob909

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.

naveenchava.2101.3916212953798965E12naveenchava.2101.3916212953798965E12
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 : 'https://login.salesforce.com',
  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 https://login.salesforce.com
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

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

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