/** * Init YoutubeAuthentication Token */ public function initialize() { $OAUTH2_CLIENT_ID = $this->container->getParameter('OAUTH2_CLIENT_ID'); $OAUTH2_CLIENT_SECRET = $this->container->getParameter('OAUTH2_CLIENT_SECRET'); $this->client = new Client(); $this->client->setClientId($OAUTH2_CLIENT_ID); $this->client->setClientSecret($OAUTH2_CLIENT_SECRET); $this->client->setScopes('https://gdata.youtube.com'); $redirect = filter_var($this->generateUrl('_youtubeauthentication', array(), UrlGeneratorInterface::ABSOLUTE_URL), FILTER_SANITIZE_URL); $this->client->setRedirectUri($redirect); }