PHP code example of icemix / laravel-passport-social-grant
1. Go to this page and download the library: Download icemix/laravel-passport-social-grant library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
icemix / laravel-passport-social-grant example snippets
namespace App\Resolvers;
use Icemix\SocialGrant\Resolvers\SocialUserResolverInterface;
use Illuminate\Contracts\Auth\Authenticatable;
use Laravel\Socialite\Facades\Socialite;
class SocialUserResolver implements SocialUserResolverInterface
{
/**
* Resolve user by provider credentials.
*
* @param string $provider
* @param string $accessToken
*
* @return Authenticatable|null
*/
public function resolveUserByProviderCredentials(string $provider, string $accessToken): ?Authenticatable
{
// Return the user that corresponds to provided credentials.
// If the credentials are invalid, then return NULL.
}
}
namespace App\Providers;
use App\Resolvers\SocialUserResolver;
use Icemix\SocialGrant\Resolvers\SocialUserResolverInterface;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* All of the container bindings that should be registered.
*
* @var array
*/
public $bindings = [
SocialUserResolverInterface::class => SocialUserResolver::class,
];
}