Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
L

laravel-passport-social-grant

> 后端框架
Open source

API authentication via social networks for your Laravel application

179 stars0 likes1 views
WebsiteGitHub

About

API authentication via social networks for your Laravel application

Laravel Passport Social Grant

This package adds a social grant for your OAuth2 server. It can be useful if have an API and want to provide the ability for your users to login/register through social networks.

As a result you will be able to exchange access_token, issued by the OAuth2 server of any social provider, to access_token and refresh_token issued by your own OAuth2 server. You will receive this access_token and return the user instance that corresponds to it on your own.

Installation

You can install this package via composer using this command:

bash
composer require coderello/laravel-passport-social-grant

The package will automatically register itself.

Configuring

As the first step, you need to implement SocialUserResolverInterface:

Here is an example using Socialite -

php
userFromToken($accessToken);
         
         return $this->findOrCreateUser($provider, $providerUser);;
    }
    
    protected function findOrCreateUser(string $provider, ProviderUser $providerUser): ?Authenticatable
    {
        // todo your logic here      
        // $email = $providerUser->getEmail();
    }
}

The next step is to bind SocialUserResolverInterface to your implementation.

You can do it by adding the appropriate key-value pair to $bindings property in AppServiceProvider:

php
 SocialUserResolver::class,
    ];
}

You are done!

Usage

Example of usage with axios:

…

Example of usage with guzzlehttp/guzzle:

…

Testing

You can run the tests with:

bash
composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Credits

Created by Illia Sakovich

Maintained by Ankur Kumar

License

The MIT License (MIT). Please see License File for more information.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

PHPgrantlaravelnetworkpassport

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category后端框架
PricingOpen source

> Related tools

N
Node.js
基于 V8 的 JavaScript 运行时
D
Django
Python 高级 Web 框架
S
Spring Boot
Java 生态主流微服务框架