Search by

pinweb / socialite-tjad

atan

TJAD OAuth2 Provider for Laravel Socialite

Package info

github.com/pinweb/SocialiteTjad

pkg:composer/pinweb/socialite-tjad

Statistics

Installs: 321

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 1

v2.1.2 2023-11-17 07:36 UTC

This package is auto-updated.

Last update: 2026-11-04 13:28:34 UTC


README

TJAD OAuth2 provider for Laravel Socialite. This package is used by downstream Laravel applications to sign in through the TJAD passport.

Requirements

  • PHP 8.2+
  • Laravel 11/12/13
  • laravel/socialite 5.29+
  • socialiteproviders/manager 4.x

Installation

composer require pinweb/socialite-tjad:^3.0

Configuration

Add the provider to config/services.php:

'tjad' => [
    'client_id' => env('TJAD_CLIENT_ID'),
    'client_secret' => env('TJAD_CLIENT_SECRET'),
    'redirect' => env('TJAD_REDIRECT_URI'),
    'passport_url' => env('TJAD_PASSPORT_URL'),
],

passport_url must point at the passport issuer, for example http://reg.tjad.cn.

Event registration

Laravel 11/12/13

use Illuminate\Support\Facades\Event;
use SocialiteProviders\Manager\SocialiteWasCalled;
use SocialiteProviders\Tjad\TjadExtendSocialite;

public function boot(): void
{
    Event::listen(SocialiteWasCalled::class, [TjadExtendSocialite::class, 'handle']);
}

Alternatively, register the listener in an EventServiceProvider.

Usage

return Socialite::driver('tjad')->redirect();

Callback:

$user = Socialite::driver('tjad')->user();

Compatibility

  • /api/user returns id, username, name, email, avatar; mobile and user_type may also be present.
  • The provider also accepts OIDC-style sub, preferred_username, and picture fields as fallbacks.
  • Client IDs remain integers; downstream client configuration does not change.