簡體   English   中英

無法使用 Salesforce API 的 php 將訪問令牌放入 SOAP 客戶端

[英]Unable to put Access Token to SOAP Client using php for Salesforce API

我正在使用 Sales Force 的 SOAP 客戶端進行 php 的 api 調用,如下所示

$client = new SforcePartnerClient();
$client->createConnection($sfPath);
$client->login($username, $password);
$client->query($query);

以上工作正常。 允許用戶通過 Oauth 登錄。 現在我已經從 Oauth 中使用 REST api 檢索了訪問令牌。 但是無法找到任何使用它登錄 SOAP api.So 的函數。所以我想知道我們如何將這個訪問令牌放入 SOAP 登錄 api 中。 我試過了

$client->setSessionHeader($accessToken);

但這不起作用。任何幫助表示贊賞。

我想出了如何為 SOAP api 使用訪問令牌。 我做了以下工作,它奏效了

 $client = new SforcePartnerClient();
 $client->createConnection($sfPath);
 $client->setSessionHeader($accessToken);
 $client->setEndpoint('https://'.$instanceUrl.'/services/Soap/u/44.0/'.$orgID);
 $client->query($query);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM