Active Collab SSL related error - php

I am creating an extension for Active Collab leveraging their SDK. Before installing SSL certificate their were no problems and my code ran fine. After the SSL installation and updating my root_URL and updating the url in the connector portion of my code I now get
Fatal error: Uncaught exception 'ActiveCollab\SDK\Exceptions\CallFailed' with message 'Peer's Certificate issuer is not recognized.'
However my SSL is installed properly. I have no other problems with it.
the relevant portion of code:
error_reporting(E_ALL);
ini_set('display_errors', 1);
require_once '/path/to/public_html/activecollab/5.8.7/activecollab-feather-sdk/vendor/autoload.php';
$authenticator = new \ActiveCollab\SDK\Authenticator\SelfHosted('****', '********','username','password', 'https://url.domain.com'); <=dummy entry
$token = $authenticator->issueToken();
The back trace shows the issue coming up in issueToken(). Does anyone know what may be causing this?

Active Collab SDK 3.1 lets you turn off SSL peer verification, like this:
$authenticator = new \ActiveCollab\SDK\Authenticator\SelfHosted('ACME Inc', 'My Awesome Application', 'you#acmeinc.com', 'hard to guess, easy to remember', 'https://my.company.com/projects', false);
$authenticator->setSslVerifyPeer(false);
Run composer update and tweak your code to turn off SSL verification, and you should be able to connect.

Related

DocuSign Error HTTPS_REQUIRED_FOR_CONNECT_LISTENER

I am getting error like below on DocuSign rest, it was working fine before:
Fatal error: Uncaught DocuSign\eSign\Client\ApiException: Error while requesting server, received a non successful HTTP code [400] with response Body: O:8:"stdClass":2:{s:9:"errorCode";s:35:"HTTPS_REQUIRED_FOR_CONNECT_LISTENER";s:7:"message";s:50:"HTTPS required for Connect listener communication.";}
TIA
This change is discussed in the Jan release notes.
Connect can only be used with https listeners (customers' servers). This applies to both developer and production accounts.
And note that the server must use a certificate that chains to a root cert in the Microsoft standard root cert list. (Self-signed certs won't work.) You can use a free cert from LetsEncrypt or a $15 cert from a reputable CA.
I'm sorry that this update caught you by surprise.
There seems some weird behaviour around this since the recent update.
Please try adding :443 to the URL, this resolved the issue in testing.

PHP Fatal error: Uncaught exception 'Google_IO_Exception' with message 'Couldn't resolve host 'accounts.google.com'

I have used google api for Analytics service. First 3 days from this implementation, it worked fine, but from 30th Apr 2015. suddenly it got trouble with the following error. I have executed this php program through a web page access by using Apache cron. When I access to the page, it return 500 error and
PHP Error log;
PHP Fatal error: Uncaught exception 'Google_IO_Exception' with
message 'Couldn't resolve host 'accounts.google.com'' in
/var/www/html/components/com_jumi/files/analytics/google-api-php-client-master/src/Google/IO/Curl.php:115\nStack
trace:\n#0
/var/www/html/components/com_jumi/files/analytics/google-api-php-client-master/src/Google/IO/Abstract.php(136):
Google_IO_Curl->executeRequest(Object(Google_Http_Request))\n#1
/var/www/html/components/com_jumi/files/analytics/google-api-php-client-master/src/Google/Auth/OAuth2.php(336):
Google_IO_Abstract->makeRequest(Object(Google_Http_Request))\n#2
/var/www/html/components/com_jumi/files/analytics/google-api-php-client-master/src/Google/Auth/OAuth2.php(308):
Google_Auth_OAuth2->refreshTokenRequest(Array)\n#3
/var/www/html/components/com_jumi/files/analytics/google-api-php-client-master/get-pageview.php(52):
Google_Auth_OAuth2->refreshTokenWithAssertion(Object(Google_Auth_AssertionCredentials))\n#4
/var/www/html/components/com_jumi/files/analytics/google-api-php-client-master/get-pageview.ph
in
/var/www/html/components/com_jumi/files/analytics/google-api-php-client-master/src/Google/IO/Curl.php
on line 115
My code to connect google api;
require_once dirname(__FILE__) . '/src/Google/autoload.php';
$client_email = 'xxx#developer.gserviceaccount.com';
$view_id = "xxx";
$private_key = #file_get_contents(dirname(__FILE__) . '/xxx.p12');
$client = new Google_Client();
$scopes = array("https://www.googleapis.com/auth/analytics.readonly");
if(isset($_SESSION["service_token"])){
$client->setAccessToken($_SESSION["service_token"]);
}
$credentials = new Google_Auth_AssertionCredentials($client_email,$scopes,$private_key);
$client->setAssertionCredentials($credentials);
if($client->getAuth()->isAccessTokenExpired()){
$client->getAuth()->refreshTokenWithAssertion($credentials);
}
$_SESSION["service_token"] = $client->getAccessToken();
...
I used this library. I have updated this to the latest in 3 days ago.
I have found similar error posts in stack overflow, but most are caused from server connection problems to 'accounts.google.com', but my server could connect it before. Also I checked host/nslookup too;
# nslookup accounts.google.com
Server: 210.157.3.4
Address: 210.157.3.4#53
Non-authoritative answer:
accounts.google.com canonical name = accounts.l.google.com.
Name: accounts.l.google.com
Address: 216.58.220.173
# host accounts.google.com
accounts.google.com is an alias for accounts.l.google.com.
accounts.l.google.com has address 216.58.220.173
accounts.l.google.com has IPv6 address 2404:6800:4004:812::200d
My most concern is that why suddenly error occurred? even though I have not changed any code /library files where I got success in API connection before.
Also I dubious about token problem too, but in my case only 2 or 3 machine has connected api, so it must not be limit of token.
I also checked my server ntp but it worked correct in my server.
I hope anyone had same issues know how to fix it. Thank you always.
--addition 20150505--
Yesterday I tried not through webpage but through command script to access php file, then api worked. Still not get why webpage access suddenly failed, but my problem itself seem to be solved.
cron before
wget http://example.com/analytics-api?f=1
cron after
php /var/www/html/components/com_jumi/files/analytics/google-api-php-client-master/get-pageview.php -f1
I had same problem today so
I just disable the firewall and it worked for me
I am using avg antivirus

YouTube API with https: "Google_IOException: p roblem with the SSL CA

Short form: I've got some PHP code that is uploading videos from my site to YouTube. I'm using the usual Google-provided PHP library, google-api-php-client. I have this code running on two servers; it works on one (https://www.example.com) but has suddenly stopped working on the other (https://dev.example.com), after a period of working nicely.
Details: The code doing the transfer is relatively standard, as far as I can tell: Once the libraries are loaded and some variables get some values, I'm doing:
$client = new Google_Client();
$client->setClientId($youtube_client_id);
$client->setClientSecret($youtube_client_secret);
$redirect = filter_var('https://example.com/upload-to-youtube', FILTER_SANITIZE_URL);
$client->setRedirectUri($redirect);
$youtube = new Google_YoutubeService($client);
$client->authenticate();
header('Location: ' . $redirect);
For the server that's not working, the $client->authenticate line throws the error:
Google_IOException: HTTP Error: (0) Problem with the SSL CA cert (path? access rights?) in Google_CurlIO->makeRequest() (line 128 of /var/www/html/example/includes/google-api-php-client/src/io/Google_CurlIO.php).
Other possibly-relevant details:
Back in the Developer's Console for my YT application, I have the following Redirect URIs set up:
https://dev.example.com/delete-from-youtube
https://dev.example.com/upload-to-youtube
https://www.example.com/delete-from-youtube
https://www.example.com/upload-to-youtube
According to the SSL certificate tester I found at https://www.sslshopper.com/ssl-checker.html, the certificates on both sites are visible and valid.
The certificate for dev.example.com is from Comodo; the certificate for www.example.com is from GeoTrust. I suppose I could try getting a new cert from GeoTrust, but I'd rather not spend the money unless I know it will fix the problem.
Both servers are running the same version of curl, if that's relevant.
It seems (to me) that the certificate and access to it should be OK (unless the certificate tester is wrong), so I don't understand where the complaint is coming from. The code and the server configuration has been unchanged for quite a while, hence my search for an external explanation. (I understand that these are Famous Last Words, but whatever.) Any thoughts out there? Thanks!
Potential duplicate question:
Amazon MarketplaceWebServiceOrders requests suddenly failing, PHP curl giving SSL CA cert error?
I had to restart the server, not just apache in order to solve the issue.

Dropbox API unable to fetch request tokens

I've developed a small Dropbox based app. I've done all the coding in PHP using symfony 1.4 and the dropbox-php library. Locally on my machine everything works just fine. But on a public test server the the dropbox-php library fails to retrieve the request tokens.
The app key and app secret are the same on both machines and I'm using the PHP OAuth extension as the OAuth library. The Dropbox App is in development mode and I've also enabled additional users for it from the Dropbox App Dashboard.
Not sure if this helps but here's the piece of code:
$oauth = new Dropbox_OAuth_PHP(sfConfig::get('app_dropbox_app_key'), sfConfig::get('app_dropbox_app_secret'));
$tokens = $oauth->getRequestToken();
...and this the exception thrown:
500 | Internal Server Error | Dropbox_Exception_RequestToken
We were unable to fetch request tokens. This likely means that your consumer key and/or secret are incorrect.
From the error message it looks like the the app key and app secret combination is wrong. But the combination is right since it works on my machine and I've been using it for days to develop this small app. The 43 port is open on the server and the php_oauth.dll is loading correctly.
Any ideas about what I'm doing wrong here?
I've switched to Dropbox_OAuth_Curl but it didn't work either. The error:
Curl error: (77) error setting certificate verify locations:
CAfile: rootca
CApath: none
So I've set:
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
And it works.
Can this be somehow related to Dropbox_OAuth_PHP not working?

Facebook SDK error: uncaught curlexception: 28: connect() timed out! thrown in php

I just follow same code from Facebook SDK example.
If FB App point to my local desktop, it will get Facebook uid and user basic information (ex email) if APP get permission from OAUTH request.
But when I upload files to server, executing $facebook->api('/me');
Fatal error: Uncaught CurlException: 28: connect() timed out! thrown in
/xxx/src/facebook.php on line 622
I still can't figure out why. It comes from CURL or SSL setting?
My remote server support SSL and CURL is enabled. My local is only CURL but no SSL support.
I think my Facebook SDK is old version, only facebook.php without base_facebook.php.
I try to use new version but can't run any program because crt error.
You get this error because your host cannot access the Facebook API. It might have an old version of Open SSL, can you check the current version on the server?
Try to connect using SSL from your local setup as well as it might be easier to debug on your local machine.
Also, see about that crt (CRC?) error and try to fix that first (don't shave too many Yak's though).

Categories