I am trying to extend Laravel\Socialite\Two\AbstractProvider , and I am unsure what is the best / proper way to do this in Laravel. Reading the documentation has lead me to believe I should be doing this in a service provider.
Any help would be great, here is the code that I have for my service provider:
SocialiteServiceProvider.php
<?php namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class SocialiteServiceProvider extends ServiceProvider {
public function register()
{
\App::bind('socialize', function()
{
echo 'DOESN\'T GET HERE';
// what do i put here once I do get here
});
}
}
Then I have a second file
SocialiteAbstractProvider.php
<?php namespace App\Services;
use Laravel\Socialite\Two\AbstractProvider;
abstract class SocialiteAbstractProvider extends AbstractProvider
{
/**
* Get the authentication URL for the provider.
*
* @param string $state
* @return string
*/
protected function getAuthUrl($state);
/**
* Get the token URL for the provider.
*
* @return string
*/
protected function getTokenUrl();
/**
* Get the raw user for the given access token.
*
* @param string $token
* @return array
*/
protected function getUserByToken($token);
/**
* Map the raw user array to a Socialite User instance.
*
* @param array $user
* @return \Laravel\Socialite\User
*/
protected function mapUserToObject(array $user);
public function redirect()
{
echo '@s1';
die;
$this->request->getSession()->set(
'state', $state = http_build_query(
array(
'token' => sha1(time().$this->request->getSession()->get('_token')),
'domain' => $_SERVER['HTTP_HOST']
)
)
);
return new RedirectResponse($this->getAuthUrl($state));
}
}
I also have properly added it to my config as I am able to see the register event.