Skip to content

Instantly share code, notes, and snippets.

@ovr
Created August 15, 2017 15:15
Show Gist options
  • Save ovr/f123028ae5d6feea79f1b7b2f7052991 to your computer and use it in GitHub Desktop.
Save ovr/f123028ae5d6feea79f1b7b2f7052991 to your computer and use it in GitHub Desktop.
<?php
class OauthController extends AbstractController
{
/**
* @Inject("SocialConnect\Auth\Service")
*
* @var \SocialConnect\Auth\Service
*/
protected $oauth;
public function getAction()
{
$id = $this->request->attributes->get('id');
if ($id) {
throw new InvalidParameterException('id');
}
// Get provider by id
$provider = $this->oauth->getProvider($id);
return new RedirectResponse($provider->makeAuthUrl());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment