• Tplink Router
  • 0 Points
  • Member since 2021

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 2
Hi Team,

I am trying to connect the salesforce using OpenID connect with NODE JS. I added a configuration in "Auth. Provider" section. Here is the Screenshot. User-added image

I configured all the properties in my application. I am using "Passport JS Node OpenID Client" to authenticate with Salesforce. Here is the github URL: https://github.com/panva/node-openid-client. But when I tried to connect I am getting error
OpenIdConnectError: invalid_client_id (client identifier invalid)
    at Client.requestErrorHandler (/Users/arthurfiddich/githome/AT/node_passport_js/node_modules/openid-client/lib/helpers/error_handler.js:16:11)
    at process._tickCallback (internal/process/next_tick.js:68:7)
I am able to connect with GOOGLE but not with the SALESFORCE. Can anyone please tell me what I have missed.? I am pasting my code below.
const { Issuer, Strategy } = require("openid-client");
const express = require("express");
const router = express.Router();
const passport = require("passport");
const winston = require("winston");
const { SSOUser: User } = require("../models/ssoUser");
Issuer.defaultHttpOptions = { timeout: 10000 };
const salesforceIssuer = new Issuer({
  issuer: "https://login.salesforce.com",
  token_endpoint: "https://login.salesforce.com/services/oauth2/token",
  userinfo_endpoint: "https://login.salesforce.com/services/oauth2/userinfo",
  jwks_uri: "https://login.salesforce.com/services/oauth2/certs"
  //   jwks_uri: "https://login.salesforce.com/id/keys"
}); // => Issuer
  "Set up issuer %s %O",

const salesforceClient = new salesforceIssuer.Client({
  client_secret: "282444478201962758",
  redirect_uris: ["http://localhost:3000/openId/salesforce/redirect"]
}); // => Client

const salesforceParams = {
  client_id: salesforceClient.client_id,
  redirect_uri: salesforceClient.redirect_uris[0],
  // scope: "api",
  response_type: "code"
  // ... any authorization request parameters go here
  // client_id defaults to client.client_id
  // redirect_uri defaults to client.redirect_uris[0]
  // response type defaults to client.response_types[0], then 'code'
  // scope defaults to 'openid'
const passReqToCallback = false; // optional, defaults to false, when true req is passed as a first
// argument to verify fn

const usePKCE = true; // optional, defaults to false, when true the code_challenge_method will be
// resolved from the issuer configuration, instead of true you may provide
// any of the supported values directly, i.e. "S256" (recommended) or "plain"

  new Strategy(
    { client: salesforceClient, params: salesforceParams, usePKCE: false },
    (tokenset, userinfo, done) => {
      console.log("tokenset", tokenset);
      console.log("access_token", tokenset.access_token);
      console.log("id_token", tokenset.id_token);
      console.log("claims", tokenset.claims);
      console.log("userinfo", userinfo);
// start authentication request
// options [optional], extra authentication parameters
router.get("/salesforce", passport.authenticate("oidc"));

// authentication callback
  (req, res) => {

passport.serializeUser((user, done) => {
  done(null, user.sub);

passport.deserializeUser((id, done) => {
  User.findById(id).then(user => {
    done(null, user);

module.exports = router;

Can anyone please help me to solve this issue and this is the blocker for me.? Also, if anyone has a good article to connect with salesforce please point me to that.

Thanks & Regards,
Hi All,

I am having a requirement to integrate QuickBooks online with Salesforce. In this, I am successfully getting authorized from Salesforce to my app on QuickBooks. I am using version V1 to getting request token and access token, secret credentials. But, when I am trying to make a request to getting all Accounts from QuickBooks app with using V3, got the Authentication error: Unauthorized. If anyone faces this type of exception and got success to make request from SF to QB please help me to getting out from this exception.

Thanks in advance!