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
Nick VerschuerenNick Verschueren 

PHP soap with connected app

Hi,

we have a php application that connects to SF with the php soap toolkit (https://github.com/developerforce/Force.com-Toolkit-for-PHP)
But this uses username and password to make a connection with SF and we prefer not to use user info for this but a connected app. I did found this: https://meltedwires.com/2016/03/07/connecting-to-salesforce-using-oauth-2-0-from-php/ but we can't get this to work plus it also does not really explain properly how to work with queries after you are connected.

Is there a clear and comprehensive tutorial that explains how to connect to SF in PHP with a connected App? or could someone point me in the right direction?

Many thanks in advance.

Best Answer chosen by Nick Verschueren
Nathan Totten 8Nathan Totten 8
You probably need to use JWT auth flow. Not in PHP, but you can see a tutorial of how to call a Salesforce API with a token that doesn't expire here: here: https://docs.zuplo.com/articles/quickstarts/gateway-over-salesforce

All Answers

SwethaSwetha (Salesforce Developers) 
HI Nick,
Recommend reviewing https://www.veonconsulting.com/salesforce-integration-using-php/
https://choy.medium.com/accessing-salesforce-data-via-rest-username-password-oauth-flow-to-a-connected-app-using-php-curl-f1aa37fb463f

If this information helps, please mark the answer as best. Thank you
Nick VerschuerenNick Verschueren
Hi Swetha, I see both are still requesting a user and a password, is there a way to connect without using user information?
Nathan Totten 8Nathan Totten 8
You probably need to use JWT auth flow. Not in PHP, but you can see a tutorial of how to call a Salesforce API with a token that doesn't expire here: here: https://docs.zuplo.com/articles/quickstarts/gateway-over-salesforce
This was selected as the best answer
Nick VerschuerenNick Verschueren
Yes, i was able to get it to work with JWT, finally found a tutorial that was relevant and clear enough (although screenshots in Japanese were not the most convenient :p )
https://tatsuno-system.co.jp/en/2020/08/05/blog_php-saleforce/