3

it possible to connect to sales force with a community license user using jsforce?

This is what I have tried

let conn = new jsforce.Connection({
    loginUrl : 'https://login.salesforce.com'
});

conn.login('[email protected]', 'mypassword', function(err, userInfo) {
    if (err) {
        console.error(err);
    }
});

This works for me when I use a full sales force user but when I use a community user I get the error: Error: INVALID_LOGIN: Invalid username, password, security token; or user locked out.

Note: I also can't login to https://login.salesforce.com with a community user so I'm wondering if there is a different loginUrl I should be using. I tried something like https://myDomain.na30.force.com/myPath but I get the same error.

I saw this post https://salesforce.stackexchange.com/a/111782 that says

community usernames are not globally unique, you need to use SOAP login with LoginScopeHeader

But I'm not sure how to add that with jsForce.

0

1 Answer 1

0

Replace the login.salesforce.com host name with the full path to the community URL.

The login URL would look like below

https://acme.force.com/customers

where acme.force.com/customers is the path of the community url

Update

Seems like a bug with JSforce with community URL ,so one has to manually try doing a SOAP callout via Javascript .

5
  • I tried the full path (e.g. https://myDomain.na30.force.com/myPath) but I still get the same error
    – rob
    Commented Oct 20, 2016 at 0:42
  • The community full path will not have instance like na30. From your org go to communities > Allcommunities and fetch the url Commented Oct 20, 2016 at 0:59
  • This is what I see when I go to allCommunities dl.dropboxusercontent.com/u/20066539/Forum%20Links/Other/… . I tried that url but it's not working.
    – rob
    Commented Oct 20, 2016 at 13:53
  • Did you hand construct XML without JSforce and try posting to sfdc Commented Oct 20, 2016 at 13:55
  • I haven't tried that. I don't have any experience with SOAP or SalesForce though and I'm on a tight timeline though so I don't think I have time to. I tried setting up the user agent OAuth flow and got that working though so I maybe just settle with that for now.
    – rob
    Commented Oct 20, 2016 at 14:48

You must log in to answer this question.

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