[Python] Simple_Salesforce Python Connected App Sandbox

Discussão em 'Python' iniciado por Stack, Agosto 27, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to use simple-salesforce to connect to a sandbox.

    Refer: https://simple-salesforce.readthedocs.io/en/stable/user_guide/examples.html

    I can successfully connect with a username/password/token and domain=test.

    sf = Salesforce(username='???',password='???',security_token='???',domain='test')


    Now, I am moving to a connected app ... my problem is that the documentation says I can use:

    sf = Salesforce(consumer_key='???', consumer_secret='???', domain='???.my')


    Then it states "If you’d like to enter a sandbox, simply add domain='test' to your Salesforce() call."

    So, that would now be:

    sf = Salesforce(consumer_key='???', consumer_secret='???', domain='test')


    But there is now nothing to tell it my instance and if I pass that, then I get:

    SalesforceAuthenticationFailed: Authentication failed (code: INVALID AUTH): You must submit either a security token or organizationId for authentication

    I tried adding the organizationId (both 15 and 18 digits), but I still got the error.

    I tried adding the full domain rather than test, which was:

    sf = Salesforce(consumer_key='???', consumer_secret='???', domain='???.sandbox.my')


    Plus I also tried:

    sf = Salesforce(username='???', consumer_key='???', consumer_secret='???', domain='???.sandbox.my')

    sf = Salesforce(username='???', organizationId='???', consumer_key='???', consumer_secret='???', domain='???.sandbox.my')

    sf = Salesforce(organizationId='???', consumer_key='???', consumer_secret='???', domain='???.sandbox.my')


    I am obviously missing how this works, but I cannot find it in the documentation.

    Has anyone done this successfully?

    Am I missing something basic here?

    Thanks in advance!!

    Continue reading...

Compartilhe esta Página