I recently had a task come up where an existing system needed to allow its users to connect their YouTube account to their site account. Pretty simple task, really, when you get down to it.
Yeah, no #3; easy peasy at first glance. But there was a complication.
For some reason (to be fair, I never did bother to ask the author the why of this...) but the library doesn't allow for the selection of the
https://www.googleapis.com/auth/youtube.force-sslScope. And THAT scope is needed to read YouTube Comments, so little problem.
So, a Googlin' I went. To find fuck all about how to get around it. Which either meant I was an idiot and missing an obvious solution or I was the only person to ever have this issue with this library.
Jury's still out on the answer, but after 500 words of "where the fuck's he going with this", the solution was pretty simple.
The new service object
<?php
namespace Mithra62\Oauth\Services;
use OAuth\OAuth2\Service\Google AS GoogleService;
class Google extends GoogleService
{
const SCOPE_YOUTUBE_HTTPS = 'https://www.googleapis.com/auth/youtube.force-ssl';
}
Tell the library where to find the new object
<?php
use OAuth\ServiceFactory;
$service = new ServiceFactory();
$service->registerService('Google62', '\Mithra62\Oauth\Services\Google');
//continue oauth setup...