lornequinn/social-auth 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

lornequinn/social-auth

Composer 安装命令:

composer require lornequinn/social-auth

包简介

Config-driven Socialite OAuth client for Laravel

README 文档

README

Config-driven Socialite OAuth client for Laravel. Add OAuth login via env vars — no boilerplate.

Supports standard Socialite providers (Google, GitHub, Facebook, etc.) and custom OAuth2 servers with a generic driver.

Requirements

  • PHP 8.2+
  • Laravel 11, 12, or 13

Installation

composer require lornequinn/social-auth

The service provider is auto-discovered.

Publish the config (optional):

php artisan vendor:publish --tag=social-auth-config

Configuration

Everything is driven by env vars. No config files to edit for the common case.

Standard Providers

For providers with built-in Socialite drivers (Google, GitHub, Facebook, etc.):

LQ_SOCIAL_PROVIDERS=google,github

LQ_SOCIAL_GOOGLE_CLIENT_ID=your-google-client-id
LQ_SOCIAL_GOOGLE_CLIENT_SECRET=your-google-client-secret

LQ_SOCIAL_GITHUB_CLIENT_ID=your-github-client-id
LQ_SOCIAL_GITHUB_CLIENT_SECRET=your-github-client-secret

Custom OAuth2 Providers

For any OAuth2 server (e.g. a Laravel Passport instance, a corporate SSO, or any other OAuth2-compliant server):

LQ_SOCIAL_PROVIDERS=myapp

LQ_SOCIAL_MYAPP_CLIENT_ID=your-client-id
LQ_SOCIAL_MYAPP_CLIENT_SECRET=your-client-secret
LQ_SOCIAL_MYAPP_AUTH_URL=https://auth.example.com/oauth/authorize
LQ_SOCIAL_MYAPP_TOKEN_URL=https://auth.example.com/oauth/token
LQ_SOCIAL_MYAPP_USER_URL=https://auth.example.com/api/user

A provider is treated as custom when AUTH_URL, TOKEN_URL, and USER_URL are all set.

Mixed

Standard and custom providers can be combined:

LQ_SOCIAL_PROVIDERS=myapp,google

Additional Options

# Route prefix (default: auth/social)
LQ_SOCIAL_ROUTE_PREFIX=auth/social

# User model (default: App\Models\User)
LQ_SOCIAL_USER_MODEL=App\Models\User

# Column to match existing users (default: email)
LQ_SOCIAL_MATCH_BY=email

# Redirect after login (default: /dashboard)
LQ_SOCIAL_REDIRECT_TO=/dashboard

# Scopes (comma-separated, per provider)
LQ_SOCIAL_GOOGLE_SCOPES=openid,profile,email

Routes

Routes are registered automatically for each configured provider:

Route Name Purpose
GET /{prefix}/{provider}/redirect social-auth.redirect Redirect to OAuth provider
GET /{prefix}/{provider}/callback social-auth.callback Handle OAuth callback

With the default prefix, Google login would be at /auth/social/google/redirect.

Generate URLs in your templates:

<a href="{{ route('social-auth.redirect', 'google') }}">Login with Google</a>

User Resolution

On callback, the package will:

  1. Fetch the authenticated user from the OAuth provider
  2. Find or create a local user by matching the configured column (default: email)
  3. Log the user in with remember: true
  4. Redirect to the intended URL (or the configured redirect_to)

License

MIT

lornequinn/social-auth 适用场景与选型建议

lornequinn/social-auth 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 11 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 04 月 08 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 lornequinn/social-auth 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 lornequinn/social-auth 我们能提供哪些服务?
定制开发 / 二次开发

基于 lornequinn/social-auth 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 11
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 45
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-04-08