百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
L

laravel-passport-social-grant

> 后端框架
开源

API 通过社交网络认证您的 Laravel 应用程序

179 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

API 通过社交网络认证您的 Laravel 应用程序

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 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

PHPgrantlaravelnetworkpassport

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类后端框架
定价开源

> 相关工具

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