+ Start a Discussion

Oauth issue when trying cookbook recipe - blank page after granting access (PHP)

I am testing out oauth recipe using dotcloud.com (love the simplicity of this service and have used it for testing other stuff ok)


Here is what I am trying to setup and test:



After creating the files and push the code to dotcloud. Testing redirects me to sf login page where I can login, then grant access, after which I am redirected to blank page....


The url is this of the page is this




I'm not a PHP expert, after looking at oauth_callback.php source I believe it's missing some parameters.


    . "&redirect_uri=" . urlencode(REDIRECT_URI);

 . "&grant_type=authorization_code"
    . "&client_id=" . CLIENT_ID
    . "&client_secret=" . CLIENT_SECRET


Anyone experienced this?


I guess the next thing I will try will be running on a local webserver (e.g. my OSX), but would rather get working on the dotcloud service.


Pat PattersonPat Patterson

Hi Mike,


It shouldn't be missing parameters - the values for CLIENT_ID etc are set by require_once 'config.php';


Can you look in the logs at dotCloud, and see if there are any PHP errors there? If there is an error relating to an untrusted certificate, you could try putting


curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);

after the existing set of curl_setopt() calls in oauth_callback.php. This tells PHP's curl library to not attempt to verify the salesforce SSL certificate. This issue is due to curl not including a proper set of root CA certificates and is described in more detail at http://boards.developerforce.com/t5/REST-API-Integration/token-failed-with-status-0/m-p/245431#M287





Thanks Pat for respose - I need to put some time aside to circle back to this one.

Pat PattersonPat Patterson

For what it's worth, I put the same code on PHPFog and it just worked: https://superpat.phpfogapp.com/forceapp/