You need to sign in to do that
Don't have an account?
Abhijit Shrikhande
Failed to login with a community user using simple-salesforce and api.
I created a community user in my Developer Org. Now I am trying to login using python. I am getting an error. If I try the same code with a Partner Portal User, then I am able to login. I have the api enabled on the Customer Community permission set.
Here is my code:
What other permissions do I need?
Thanks,
Abhijit
Here is my code:
from simple_salesforce import Salesforce sf = Salesforce(username='rose.gonzalez@edge.com.space', password='*****', security_token='', sandbox=False)
What other permissions do I need?
Thanks,
Abhijit
- The URL endpoint you're logging in to is different. Instead of login.salesforce.com you'll need to log in at https://yourdomain/yourcommunitypath/
- The user you're logging in to must be a member of that community.
- Users with customer-tier licenses do not have roles, but those with partner tier (or customer+ tier) licenses do. I don't believe this affects authentication via the API, but it's good to be aware of.
There's this article that gives an oauth overview for community users:https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/quickstart_communities.htm
So looking at your code, I'm not sure how the Salesforce class in Python is supposed to work, but according to the documentation it apparently allows you to enter a URL:
https://pypi.python.org/pypi/simple-salesforce
Maybe try futzing with the way you make the call and see if any of the variations work with your community URL?
When you say you used a partner portal user, were you using this Python library with a portal user to log in to a portal? Or to a community? The distinction is very important. Users with legacy portal licenses can be made a member of a community. And while portals ran at the same domain and path as your regular salesforce org (e.g. https://naxx.salesforce.com/), communities run under a different domain and path (either https://my-registered-force-dot-com-domain.force.com/communitypath/ or under a custom domain like community.mycompany.com). So the endpoint location you log in to is important. So if that Python library is always trying to use naxx.salesforce.com or login.salesforce.com as the endpoint to log in, it will not work for logging in to a community.
Check out the library documentation (https://pypi.python.org/pypi/simple-salesforce) I mentioned in my last comment. The object seems to accept an instance parameter in some circumstances: If that library somehow allows you to pass an instance_url along with a username & password, it may work for a community. But if not, that library may need to be refactored to support community cloud and you might want to handle the authentication using something else.