View Issue Details

IDProjectCategoryView StatusLast Update
0003163Composr non-bundled addons[Composr] galleriespublic2017-03-28 18:54
ReporterPaul FlavelAssigned ToChris Graham 
SeverityMajor-bug 
Status resolvedResolutionfixed 
Summary0003163: Youtube API
DescriptionI am running the final version 10.
I have setup the youtube api etc correctly, however upon clicking allow for managing my youtube acct I get the following error.

Cannot connect to the server in the URL, https://accounts.google.com/o/oauth2/token; the “file_get_contents(https://216.58.220.13/o/oauth2/token) [<a href='http://php.net/manual/en/function.file-get-contents.php'>function.file-get-contents.php</a>]: failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found ” error was received.

TagsNo tags attached.
Time estimation (hours)
Sponsorship open

Activities

Chris Graham

2017-03-27 11:39

administrator   ~0004903

Please try the attached sources/files2.php file.

That said, I believe you're not running the PHP cURL extension. If you can get that installed I do advise it. Currently Composr is having to fall back to the PHP streams downloader, which is the worst one.

Guest

2017-03-27 21:18

viewer   ~0004908

curl
cURL support enabled
cURL Information 7.36.0

Still getting the same error.

Chris Graham

2017-03-27 22:26

administrator   ~0004909

What happens if you type the following into Commandr?


:var_dump(curl_version());

Guest

2017-03-27 22:37

viewer   ~0004910

:var_dump(curl_version()); →

array(9) {
  ["version_number"]=>
  int(467968)
  ["age"]=>
  int(3)
  ["features"]=>
  int(34493)
  ["ssl_version_number"]=>
  int(0)
  ["version"]=>
  string(6) "7.36.0"
  ["host"]=>
  string(23) "x86_64-redhat-linux-gnu"
  ["ssl_version"]=>
  string(14) "OpenSSL/1.0.1e"
  ["libz_version"]=>
  string(5) "1.2.3"
  ["protocols"]=>
  array(20) {
    [0]=>
    string(4) "dict"
    [1]=>
    string(4) "file"
    [2]=>
    string(3) "ftp"
    [3]=>
    string(4) "ftps"
    [4]=>
    string(6) "gopher"
    [5]=>
    string(4) "http"
    [6]=>
    string(5) "https"
    [7]=>
    string(4) "imap"
    [8]=>
    string(5) "imaps"
    [9]=>
    string(4) "ldap"
    [10]=>
    string(5) "ldaps"
    [11]=>
    string(4) "pop3"
    [12]=>
    string(5) "pop3s"
    [13]=>
    string(4) "rtsp"
    [14]=>
    string(3) "scp"
    [15]=>
    string(4) "sftp"
    [16]=>
    string(4) "smtp"
    [17]=>
    string(5) "smtps"
    [18]=>
    string(6) "telnet"
    [19]=>
    string(4) "tftp"
  }
}

Guest

2017-03-28 00:05

viewer   ~0004911

allow_url_include is turned off by our host. Does this affect it?

Chris Graham

2017-03-28 12:41

administrator   ~0004914

I'm currently testing on my machine. I was able to authorise, but I'm going to see if I can trigger a condition via fiddling with our downloader code fallback mechanism.

As an unrelated note, I saw that the config option descriptions no longer related to how you set up Google Keys with Google. Updated...

This is the oAuth “Client ID”:
Set up for a project on the Google API console.
Enable the Youtube Data API on the project from Library (open it and Enable).
Create an oAuth server key from Credentials (this will get you your “Client ID” and “Client Secret” values.
Make sure you whitelist http://yourbaseurl/adminzone/index.php?page=youtube_oauth as an Authorized Redirect URI).
Add an API key from Credentials (this will get you your “YouTube API key” value).
You will also want to increase your video length limit.
You will then be able to authorise with Youtube from Admin Zone > Setup > YouTube API access.

Chris Graham

2017-03-28 16:10

administrator   ~0004915

I can reproduce this issue after I disable cURL, I'm working on it.

Chris Graham

2017-03-28 18:29

administrator   ~0004916

Ok. So on your system for some reason cURL is failing. I don't know why, but it can happen, cURL can be built with an OpenSSL that doesn't negotiate SSL correctly for modern servers.

It's falling back to the stream wrapper HTTPS implementation, which unfortunately I can see had 4 distinct issues...

1) HTTPS stream wrapper errors getting eaten up (stream wrappers have multiple layers of error message, and we were only showing the last)
2) HTTPS broken with stream wrappers due to not passing host header for certification validation. Then if fixed HTTPS broken with stream wrappers anyway due to PHP ignoring host header when validating certificate; we have to use the correct host in the connect URL and bypass our "use local DNS server" feature
3) HTTPS broken with stream wrappers due to not passing in SSL context options properly
4) Fallback after cURL fails is broken, as earlier code customises request for cURL then doesn't rebuild the request

I think honestly the stream wrapper fallback was never tested because it needs the PHP OpenSSL extension to be installed, and on many systems it isn't anyway. Usually cURL is working.

I've reattached sources/files2.php.

Chris Graham

2017-03-28 18:30

administrator  

files2.php (100,031 bytes)

Chris Graham

2017-03-28 18:54

administrator   ~0004917

Sadly I proceeded to test the addon and it's not working because Google have removed support for their Data API v2 and Data API v3 seems very different :(.
It would be a couple of days work to revive it.

Issue History

Date Modified Username Field Change
2017-03-27 07:11 Paul Flavel New Issue
2017-03-27 10:01 Chris Graham Project Composr => Composr non-bundled addons
2017-03-27 11:38 Chris Graham File Added: files2.php
2017-03-27 11:39 Chris Graham Note Added: 0004903
2017-03-27 11:39 Chris Graham Status non-assigned => resolved
2017-03-27 11:39 Chris Graham Resolution open => fixed
2017-03-27 11:39 Chris Graham Assigned To => Chris Graham
2017-03-27 21:18 Guest Note Added: 0004908
2017-03-27 22:26 Chris Graham Note Added: 0004909
2017-03-27 22:37 Guest Note Added: 0004910
2017-03-28 00:05 Guest Note Added: 0004911
2017-03-28 12:41 Chris Graham Note Added: 0004914
2017-03-28 16:10 Chris Graham Note Added: 0004915
2017-03-28 18:29 Chris Graham Note Added: 0004916
2017-03-28 18:29 Chris Graham File Deleted: files2.php
2017-03-28 18:30 Chris Graham File Added: files2.php
2017-03-28 18:54 Chris Graham Note Added: 0004917