1

I've been banging my head against the wall with this. I'm ultimately trying to connect to my Developer instance using the REST API, but no amount of gems or writing my own has helped.

Now, I'm simply trying to connect via curl but keep receiving the following error:

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

I tried connecting to http: and https: versions of login.salesforce.com, na15.salesforce.com, and test.salesforce.com

uhr@eblinux:~/Documents/apps/mvp$ curl https://na15.salesforce.com/services/oauth2/authorize?response_type=code&client_id=3MVG9A2kN3Bn17hsBXbAjW27v5gXyR8jRRWCkEtorbHeLQOsaUf_iyRCEvVkg1pkqBa7_BcRdMzOk64Mu1WK_&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Fservices%2Fsalesforce%2Fcallback
    [1] 28192
    [2] 28193
    [2]+  Done                    client_id=3MVG9A2kN3Bn17hsBXbAjW27v5gXyR8jRRWCkEtorbHeLQOsaUf_iyRCEvVkg1pkqBa7_BcRdMzOk64Mu1WK_
    uhr@eblinux:~/Documents/apps/mvp$ error=invalid_client_id&error_description=client%20identifier%20invalid^C

uhr@eblinux:~/Documents/apps/mvp$ curl https://login.salesforce.com/services/oauth2/authorize?response_type=code&client_id=3MVG9A2kN3Bn17hsBXbAjW27v5gXyR8jRRWCkEtorbHeLQOsaUf_iyRCEvVkg1pkqBa7_BcRdMzOk64Mu1WK_&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Fservices%2Fsalesforce%2Fcallback
    [1] 28219
    [2] 28220
    [2]+  Done                    client_id=3MVG9A2kN3Bn17hsBXbAjW27v5gXyR8jRRWCkEtorbHeLQOsaUf_iyRCEvVkg1pkqBa7_BcRdMzOk64Mu1WK_
    uhr@eblinux:~/Documents/apps/mvp$ error=invalid_client_id&error_description=client%20identifier%20invalid^C

uhr@eblinux:~/Documents/apps/mvp$ curl https://test.salesforce.com/services/oauth2/authorize?response_type=code&client_id=3MVG9A2kN3Bn17hsBXbAjW27v5gXyR8jRRWCkEtorbHeLQOsaUf_iyRCEvVkg1pkqBa7_BcRdMzOk64Mu1WK_&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Fservices%2Fsalesforce%2Fcallback
    [1] 28228
    [2] 28229
    [2]+  Done                    client_id=3MVG9A2kN3Bn17hsBXbAjW27v5gXyR8jRRWCkEtorbHeLQOsaUf_iyRCEvVkg1pkqBa7_BcRdMzOk64Mu1WK_
    uhr@eblinux:~/Documents/apps/mvp$ error=invalid_client_id&error_description=client%20identifier%20invalid

uhr@eblinux:~/Documents/apps/mvp$ curl https://na15.salesforce.com/services/oauth2/authorize?response_type=code&client_id=3MVG9A2kN3Bn17hsBXbAjW27v5gXyR8jRRWCkEtorbHeLQOsaUf_iyRCEvVkg1pkqBa7_BcRdMzOk64Mu1WK_&redirect_uri=https%3A%2F%2Flocalhost%3A3000%2Fservices%2Fsalesforce%2Fcallback
    [1] 28237
    [2] 28238
    [2]+  Done                    client_id=3MVG9A2kN3Bn17hsBXbAjW27v5gXyR8jRRWCkEtorbHeLQOsaUf_iyRCEvVkg1pkqBa7_BcRdMzOk64Mu1WK_
    uhr@eblinux:~/Documents/apps/mvp$ error=invalid_client_id&error_description=client%20identifier%20invalid^C

I've attached a screenshot of my sample application page.

Sample Connected App Page

Although a great article, I'm not looking to do user login/signup via OAuth authentication like: http://geekymartian.com/articles/ruby-on-rails-4-salesforce-oauth-implementation/

Aside: Why does Salesforce still reference Sinatra projects from 2010 as their go to code sample for connecting?

1 Answer 1

3

You have to use OAuth to invoke the Salesforce.com REST API's. All the standard REST (as well as SOAP) API calls require authentication and authorization to access. I assume from your example you are trying to use the OAuth bearer token? Here is a sample that you can use from curl. (It says Chatter API but it applies to all API calls): http://www.salesforce.com/us/developer/docs/chatterapi/Content/quickstart_connecting.htm

You can also create a unauthenticated REST endpoint via a Force.com Site. http://www.wadewegner.com/2013/03/creating-anonymous-rest-apis-with-salesforce-com/ However this would expose data / operations to anyone calling the REST endpoint so should only be done with care.

Hope that helps.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .