PHPackages                             pltrue/thirdparty\_oauth - 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. pltrue/thirdparty\_oauth

ActiveLibrary

pltrue/thirdparty\_oauth
========================

这是一个第三方授权登录扩展包。目前支持GITHUB、GITEE、谷歌、微博、微信、QQ等授权登录

v2.0(5y ago)351.5k9[3 PRs](https://github.com/pl1998/thirdparty_oauth/pulls)MITPHP

Since Sep 17Pushed 5y ago1 watchersCompare

[ Source](https://github.com/pl1998/thirdparty_oauth)[ Packagist](https://packagist.org/packages/pltrue/thirdparty_oauth)[ RSS](/packages/pltrue-thirdparty-oauth/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (1)Versions (46)Used By (0)

ThirdpartyOauth
===============

[](#thirdpartyoauth)

[![](https://camo.githubusercontent.com/f8df3091bbe1149f398a5369b2c39e896766f9f6efba3477c63e9b4aa940ef14/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e)](https://packagist.org/packages/pltrue/thirdparty_oauth)[![Build Status](https://camo.githubusercontent.com/45d6d12468354ead6c591de7785cea09dad3a7481a1c8bc4b4da3edb7fa9eaea/68747470733a2f2f7472617669732d63692e6f72672f706c313939382f746869726470617274795f6f617574682e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/pl1998/thirdparty_oauth)[![StyleCI build status](https://camo.githubusercontent.com/2b16e6815f40c1dc42169f531ecfc119bc0e99acc9eeff1c248a666dec32c67e/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3239353637373230322f736869656c64)](https://camo.githubusercontent.com/2b16e6815f40c1dc42169f531ecfc119bc0e99acc9eeff1c248a666dec32c67e/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3239353637373230322f736869656c64)[![](https://camo.githubusercontent.com/bc54b55995a44b022bc23d181ff6d8eaa31c9e583374c6251da7e36de4e806ef/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d76372e302b2d626c7565)](https://packagist.org/packages/pltrue/thirdparty_oauth)[![](https://camo.githubusercontent.com/58ad6dcefc0cf7bf5444ef30e90d66c71618cd52ded42999b762feaaa7c5e519/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646f776e6c6f6164732d33372d627269676874677265656e)](https://packagist.org/packages/pltrue/thirdparty_oauth)

这是一个社会化登录的第三方登录扩展包

v2.0版本兼容 [Laravel-Octane](https://github.com/laravel/octane)

安装
--

[](#安装)

使用 composer 安装:

```
$ composer require pltrue/thirdparty_oauth "v1.7"
```

贡献
--

[](#贡献)

你可以通过以下三种方式做出贡献:

1. bug反馈 [issue tracker](https://github.com/pl1998/thirdparty_oauth/issues).
2. 回答问题或修复错误 [issue tracker](https://github.com/pl1998/thirdparty_oauth/issues).
3. 贡献新特性或更新wiki。

目前支持第三方登录
---------

[](#目前支持第三方登录)

- 1.QQ(app/h5/web)
- 2.微信(web扫码)
- 3.微博(app/h5/web)
- 4.小米(web/h5)
- 5.抖音
- 6.世纪互联(微软)
- 7.微软
- 8.gitee
- 9.github
- 10.gitlab
- 11.google
- 12.line

---

贡献者🎉、以及合并日志
-----------

[](#贡献者以及合并日志)

日期更新级别更新内容贡献者当前状态2020-12-06fix 、feat新增`Microsoft`登录 修复微信、QQ的bug[742481030](https://github.com/742481030)已合并到master分支2020-12-08feat新增`小米账户`登录[742481030](https://github.com/742481030)已合并到master分支2020-12-09feat新增`google账户`登录[742481030](https://github.com/742481030)已合并到master分支2020-12-10feat新增`华为账户`登录[742481030](https://github.com/742481030)已合并到master分支2020-12-11fixqq统一使用json接口[742481030](https://github.com/742481030)已合并到master分支2020-12-12feat新增`抖音账户`登录[742481030](https://github.com/742481030)已合并到master分支2020-12-13feat新增`Line账户`登录[742481030](https://github.com/742481030)已合并到master分支2020-12-29fix增加兼容支付宝qq app混合应用兼容[742481030](https://github.com/742481030)已合并到master分支2020-12-29feat新增`京东账户`登录[742481030](https://github.com/742481030)已合并到master分支2020-12-29fix兼容laravel7\*[pl1998](https://github.com/pl1998)已合并到master分支2021-04-19feat兼容laravel8\* 支持laravel发布配置文件[pl1998](https://github.com/pl1998)已合并到master分支2021-05-15featv2.0版本 兼容laravel8\* Laravel Octane 常驻内存[pl1998](https://github.com/pl1998)已合并到master分支如何申请应用授权？
---------

[](#如何申请应用授权)

- [github应用创建地址](https://github.com/settings/developers)
- [gitee应用创建地址](https://gitee.com/oauth/applications)
- [gitlab应用创建地址](https://gitlab.com/oauth/applications)
- [微博应用创建地址](https://open.weibo.com/)
- [microcoft应用创建地址](https://azure.com/)
- [QQ互联创建地址](https://connect.qq.com/index.html)
- [小米应用](https://dev.mi.com/console/)
- [google应用](https://console.developers.google.com)
- [京东应用](https://jos.jd.com/)

##### 参数说明

[](#参数说明)

> redirect\_url 回调地址将使用方法写到回调接口即可 获取到用户的一些基础信息
> client\_id 应用授权id
> client\_secret 应用授权key
> 所有支持平台的类型 `github` `gitee` `gitlab` `weibo` `qq` `weixin` `alipay` `microsoft` 配置文件下标一致

##### 建议

[](#建议)

> 前后端分离下建议前端直接请求授权接口，后端负责回调接口即可

#### PHP-FPM下安装

[](#php-fpm下安装)

```
composer require pltrue/thirdparty_oauth "v1.7"
```

#### Laravel Octane 常驻内存下安装

[](#laravel-octane--常驻内存下安装)

```
composer require pltrue/thirdparty_oauth "v2.0"
```

#### 发布配置

[](#发布配置)

```
php artisan vendor:publish --tag=oauth
```

### 简单使用

[](#简单使用)

- 授权方法

```
$api = new SocialiteAuth(config('oauth.github'));
return $api->redirect('github');
```

\*回调方法

```
public function githubCallBack()
    {
        $auth = new SocialiteAuth(config('oauth.github'));
        $user = $auth->driver('github')->user();

        $users = User::query()->where('oauth_id',$user->id)->first();

        if(!$users){
            $users= User::query()->create([
                'name'=> empty($user->name) ?? $user->login,
                'email'=>$user->email,
                'avatar'=>$user->avatar_url,
                'oauth_id'=>$user->id,
                'bound_oauth'=>1
            ]);
        }
        return $this->respondWithToken($users);
    }
```

返回示例
----

[](#返回示例)

[![在这里插入图片描述](https://camo.githubusercontent.com/041adb4df48287d47d808117ea79ea68e8cb04f4747b42396d1e4941b532f83d/68747470733a2f2f696d672d626c6f672e6373646e696d672e636e2f32303231303131353137343335313437332e706e673f782d6f73732d70726f636573733d696d6167652f77617465726d61726b2c747970655f5a6d46755a33706f5a57356e6147567064476b2c736861646f775f31302c746578745f6148523063484d364c7939696247396e4c6d4e7a5a473475626d56304c334678587a51794d444d794d5445332c73697a655f31362c636f6c6f725f4646464646462c745f3730237069635f63656e746572)](https://camo.githubusercontent.com/041adb4df48287d47d808117ea79ea68e8cb04f4747b42396d1e4941b532f83d/68747470733a2f2f696d672d626c6f672e6373646e696d672e636e2f32303231303131353137343335313437332e706e673f782d6f73732d70726f636573733d696d6167652f77617465726d61726b2c747970655f5a6d46755a33706f5a57356e6147567064476b2c736861646f775f31302c746578745f6148523063484d364c7939696247396e4c6d4e7a5a473475626d56304c334678587a51794d444d794d5445332c73697a655f31362c636f6c6f725f4646464646462c745f3730237069635f63656e746572)

License
-------

[](#license)

---

MIT

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 54.5% 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 ~8 days

Total

28

Last Release

1827d ago

Major Versions

v1.7 → v2.0-beta2021-05-15

### Community

Maintainers

![](https://www.gravatar.com/avatar/dc9705d4dfa84455d0d7ac04775b7fb2ffc2a613de26e5f34cd8685d05edc6fb?d=identicon)[pl1998](/maintainers/pl1998)

---

Top Contributors

[![742481030](https://avatars.githubusercontent.com/u/59884249?v=4)](https://github.com/742481030 "742481030 (79 commits)")[![pl1998](https://avatars.githubusercontent.com/u/43993206?v=4)](https://github.com/pl1998 "pl1998 (53 commits)")[![2540463097](https://avatars.githubusercontent.com/u/34671262?v=4)](https://github.com/2540463097 "2540463097 (13 commits)")

---

Tags

laraveloauth2phpthinkphp

### Embed Badge

![Health badge](/badges/pltrue-thirdparty-oauth/health.svg)

```
[![Health](https://phpackages.com/badges/pltrue-thirdparty-oauth/health.svg)](https://phpackages.com/packages/pltrue-thirdparty-oauth)
```

###  Alternatives

[neuron-core/neuron-ai

The PHP Agentic Framework.

1.8k245.3k21](/packages/neuron-core-neuron-ai)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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