PHPackages                             larva/laravel-passport-socialite - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. larva/laravel-passport-socialite

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

larva/laravel-passport-socialite
================================

This is a Laravel passport grant for social.

1.0.4(4y ago)12.8k1MITPHP

Since Mar 9Pushed 4y agoCompare

[ Source](https://github.com/larvatecn/laravel-passport-socialite)[ Packagist](https://packagist.org/packages/larva/laravel-passport-socialite)[ RSS](/packages/larva-laravel-passport-socialite/feed)WikiDiscussions master Synced yesterday

READMEChangelog (5)Dependencies (3)Versions (6)Used By (0)

laravel-passport-socialite
==========================

[](#laravel-passport-socialite)

The missing social authentication plugin (i.e. SocialGrant) for laravel passport.

Laravel Passport Socialite
==========================

[](#laravel-passport-socialite-1)

The missing social authentication plugin (i.e. SocialGrant) for laravel passport.

Description
-----------

[](#description)

This package helps integrate social login using laravel's native packages i.e. (passport and socialite). This package allows social login from the providers that is supported in laravel/socialite package.

Getting Started
---------------

[](#getting-started)

To get started add the following package to your composer.json file using this command.

`composer require larva/laravel-passport-socialite -vv`

Configuration
-------------

[](#configuration)

When composer installs this package successfully, register the `Larva\Passport\Socialite\PassportSocialiteGrantProvider::class` in your `config/app.php` configuration file.

```
'providers' => [
    // Other service providers...
    Larva\Passport\Socialite\PassportSocialiteGrantProvider::class,
],
```

**Note: You need to configure third party social provider keys and secret strings as mentioned in laravel socialite documentation **

使用
--

[](#使用)

### S设置你的 User 模型

[](#s设置你的-user-模型)

添加 `findAndValidateForPassportSocialite` 方法到你的 `User` 模型， `findAndValidateForPassportSocialite` 方法接受两个参数 `$provider` and `$socialUser`。

**$provider - string - 你的社交账户提供商。如： facebook, google。**

**$socialUser - \\Larva\\Socialite\\Contracts\\User - 社交服务商获取到的用户实例**

**And the function should find the user which is related to that information and return user object or return null if not found**

Below is how your `User` model should look like after above implementations.

```
namespace App\Models;

class User extends Authenticatable {

    use HasApiTokens, Notifiable;

    /**
    * Find user using social provider's user
    *
    * @param string $provider Provider name as requested from oauth e.g. facebook
    * @param \Larva\Socialite\Contracts\User $socialUser User of social provider
    *
    * @return User|void
    */
    public static function findAndValidateForPassportSocialiteRequest(string $provider, \Larva\Socialite\Contracts\User $socialUser) {
        if( $socialUser->user) {
            return $socialUser->user;
        }

        // 你其他代码，例如自动注册用户 如果你绑定了用户 \Larva\Socialite\Contracts\User 里面有你绑定的用户模型实例
        return;
    }
}
```

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~78 days

Total

5

Last Release

1580d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/534cdb651e8c806590fa945c6b5a18f361613848e890db1349f4a9fbcae1a650?d=identicon)[xutongle](/maintainers/xutongle)

---

Top Contributors

[![xutongle](https://avatars.githubusercontent.com/u/46956076?v=4)](https://github.com/xutongle "xutongle (4 commits)")[![xutl](https://avatars.githubusercontent.com/u/20939388?v=4)](https://github.com/xutl "xutl (2 commits)")

---

Tags

laravellaravel-passportoauthpassportsecretsocialsocial-loginsocial-providersocialitelaravelpassportsocial

### Embed Badge

![Health badge](/badges/larva-laravel-passport-socialite/health.svg)

```
[![Health](https://phpackages.com/badges/larva-laravel-passport-socialite/health.svg)](https://phpackages.com/packages/larva-laravel-passport-socialite)
```

###  Alternatives

[corbosman/laravel-passport-claims

Add claims to Laravel Passport JWT Tokens

88655.9k](/packages/corbosman-laravel-passport-claims)[coderello/laravel-passport-social-grant

Social Grant for Laravel Passport

179607.4k3](/packages/coderello-laravel-passport-social-grant)[adaojunior/passport-social-grant

Social grant for Laravel Passport

116279.2k1](/packages/adaojunior-passport-social-grant)[jeremy379/laravel-openid-connect

OpenID Connect support to the PHP League's OAuth2 Server. Compatible with Laravel Passport.

55342.3k2](/packages/jeremy379-laravel-openid-connect)[schedula/laravel-passport-socialite

The missing laravel passport feature for social authentication

4922.6k](/packages/schedula-laravel-passport-socialite)[danjdewhurst/laravel-passport-facebook-login

Facebook Token Request Grant for Laravel Passport

2824.4k](/packages/danjdewhurst-laravel-passport-facebook-login)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
