function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
M477.ax944M477.ax944 

Can't log into sandbox API

Hi,

I'm developing a web form and are using the php with the web API to pull down a few records from an object to populate a picklist. This seems to work fine in a private developer account and the organisations main account. However, when I try to access the API in the sandbox I always recieve a login error in the php log file and the page won't load at all.

 

I have checked the username, password, security token, wsdl, user permissions and IP filtering and can't find anything blocking the api from the sandbox.

 

Have I missed anything? Why can't I log into the sandbox through the web api?

 

Thanks,

Matt

SuperfellSuperfell

for sandbox, make sure your login requests are going to test.salesforce.com

M477.ax944M477.ax944

Where can I set the login request?

 

Thanks,

Matt

M477.ax944M477.ax944

Tried a different sandbox and it seemed to work. Not sure what the problem was.

Justin TilsonJustin Tilson

Error message: INVALID_LOGIN: Invalid username, password, security token; or user locked out.

 

My connection works fine in production but not in the sandbox environment.

 

It's clearly trying to connect to the production authentication servers:

 

POST /services/Soap/c/20.0 HTTP/1.1 Host: login.salesforce.com Connection: Keep-Alive User-Agent: salesforce-toolkit-php/20.0 Content-Type: text/xml; charset=utf-8 SOAPAction: "" Content-Length: 359

 

I think the host needs to be test.salesforce.com but I can't figure out where to configure it.

 

Anyone else muddled through this?

 

Justin TilsonJustin Tilson

I answered my own question. Look at the bottom of enterprise.wsdl.xml

 

    <service name="SforceService">
        <documentation>Sforce SOAP API</documentation>
        <port binding="tns:SoapBinding" name="Soap">
            <soap:address location="https://test.salesforce.com/services/Soap/c/21.0/0DFP00000008OSU"/>
        </port>
    </service>

M477.ax944M477.ax944

I checked that originally but noticed it was already set to the test server when I downloaded it from the sandbox so wasn't sure if there was something else that needed changing. It's all working fine in the newley created second sandbox though.