Issue while connecting salesforce through jsforce npm module.

Not applicable

we are trying to connect salesforce through jsforce npm module in Apigee edge.

We are able to get Code, and then calling callback, but authorize function in callback not working, it is giving http error 400. Error printed on browser -

{"message":"\r\n\n\n\n\n\n\n\n\n\n

Stronger security is required

To access this website, update your web browser or upgrade your operating system to support TLS 1.1 or TLS 1.2.

For more information, see Salesforce disabling TLS 1.0.\n

\n\n","name":"ERROR_HTTP_400","fileName":"/organization/environment/api/node_modules/jsforce/lib/oauth2.js","lineNumber":192}

Your response will be highly appreciable.

Attaching proxy in zip.

apiproxy.zip

0 2 993
2 REPLIES 2

I cannot tell from your description. It seems like the failing request is from the browser to salesforce, to redeem the code. In other words, there is no Edge involved, at that point. The API Proxy is not included in that exchange. Am I correct in my understanding?

What web browser are you using, please? Specifically what version on which operating system?

There is a known issue with IE on Windows, in which TLS1.1 and TLS1.2 must be enabled, explicitly, for some versions of Windows. It's not on by default. This could be the problem.

Also, see this note: https://success.salesforce.com/answers?id=9063A000000svjmQAA

Not applicable

Hi @vivek chikane,. I took a second stab at your code to try it on my org. It worked fine. One of the things I enabled was https on my API Proxy. For security best practices, I also include code to store secrets in Apigee Vault. You can find a full-fledged example https://github.com/dzuluaga/apigee-tutorials/tree/master/apiproxies/jsforce-sfdc-oauth-nodejs-expres....

Please let me know if I'm missing anything.

======

jsforce-sfdc-oauth-nodejs-express-app

Example of three-legged oauth with SalesForce leveraging jsforce Node.js module, express, and Apigee.

apigee_jsforce_expressjs_app

Configuration

Replace app.js with SFDC credentials

var sforce_credentials = {
    clientId: process.env.clientId || 'REPLACE_WITH_SFDC_CLIENT_ID',
    clientSecret: process.env.clientSecret || 'REPLACE_WITH_SFDC_CLIENT_SECRET',
    redirectUri: process.env.redirectUri ||  'REPLACE_WITH_SFDC_REDIRECT_URI'
}

Run locally

$ npm install
$ npm start

use clientId={clientId} clientSecret={clientSecret} redirectUri={redirectUri} npm start

Go to: http://localhost:3000/oauth/auth

Run on Apigee

Deploy
$ apigeetool deploynodeapp -n jsforce-oauth-express-nodejs-app -d . -m app.js -o testmyapi -e test -b /jsforce-oauth-express-nodejs-app -u $ae_username -p $ae_password -V

Go to: https://testmyapi-test.apigee.net/jsforce-oauth-express-nodejs-app/oauth/auth

Uncomment sections to use Apigee Vault to store clientId, clientSecret, and redirectUri.