承接 lornequinn/social-auth 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

lornequinn/social-auth

最新稳定版本:v1.0.1

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

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固