I am calling the discoverAndAdd
method of intuit.
According to the specification mentioned here.
I am getting the Authorization headers using the below code:
IntuitAggCatHelpers::GetOAuthTokens(&$oauth_token, &$oauth_token_secret);
$signatures = array('consumer_key' => OAUTH_CONSUMER_KEY,
'shared_secret' => OAUTH_SHARED_SECRET,
'oauth_token' => $oauth_token,
'oauth_secret' => $oauth_token_secret);
$oauthObject = new OAuthSimple();
$oauthObject->reset();
$name='institutions';
$result = $oauthObject->sign(array(
'path' => FINANCIAL_FEED_URL . 'v1/' . $name.'/100000/logins',
'parameters' => array('oauth_signature_method' => 'HMAC-SHA1',
'Host' => FINANCIAL_FEED_HOST),
'signatures' => $signatures));
And then I am calling the discoverAndAdd
method using the below code:
$xmlStr='<InstitutionLogin xmlns="http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1">
<credentials>
<credential>
<name>Banking Userid</name>
<value>demo</value>
</credential>
<credential>
<name>Banking Password</name>
<value>go</value>
</credential>
</credentials>
</InstitutionLogin>';
define('XML_PAYLOAD', $xmlStr);
define('XML_POST_URL', $result['signed_url'];
/**
* Initialize handle and set options
*/
$ch = curl_init();
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_URL, XML_POST_URL);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, XML_PAYLOAD);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-type: application/xml',
'Content-length: ' . strlen(XML_PAYLOAD)
));
$result = curl_exec($ch);
It is supposed to return some challenge headers like this question
but I am getting the below headers :
HTTP/1_1_401_Code:ApplicationAuthenticationFailed,Type:SYSTEM Date:_Tue,_03_Dec_2013_08:10:17_GMT intuit_tid:_gw-bb793220-51cd-420b-8502-c4674db06611 Content-Type:_text/plain Content-Length:_0
The status code tells that there is some problem in authentication but the authentication token is working fine for GetAll method.