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('user@domain.com', 'mypassword', function(err, userInfo) {
    if (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.


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

The login URL would look like below


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


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

  • I tried the full path (e.g. https://myDomain.na30.force.com/myPath) but I still get the same error
    – rob
    Oct 20 '16 at 0:42
  • The community full path will not have instance like na30. From your org go to communities > Allcommunities and fetch the url Oct 20 '16 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
    Oct 20 '16 at 13:53
  • Did you hand construct XML without JSforce and try posting to sfdc Oct 20 '16 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
    Oct 20 '16 at 14:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.