xerxes-on/one-id

OneID Uzbekistan OAuth provider for Laravel Socialite

Maintainers

Package info

github.com/xerxes-on/one-id

pkg:composer/xerxes-on/one-id

Transparency log

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

dev-main 2026-08-26 12:11 UTC

This package is auto-updated.

Last update: 2026-08-26 12:12:37 UTC


README

Latest Version Total Downloads License

A reusable Laravel Socialite provider for Uzbekistan's OneID OAuth service, available on Packagist.

This package contains only the OAuth driver. It intentionally does not contain an application user model, database migrations, callback routes, user matching, tokens for a consuming API, or application-specific redirect behavior.

Requirements

  • PHP 8.1+
  • Laravel 10, 11, or 12
  • Laravel Socialite 5.16+

Installation

Install the package from Packagist:

composer require xerxes-on/one-id

Laravel discovers the service provider automatically; no manual registration is required. Publish the configuration only when you need to override its defaults:

php artisan vendor:publish --tag=one-id-config

Configuration

Set the credentials and callback URI in the consuming application's .env:

ONE_ID_CLIENT_ID=
ONE_ID_CLIENT_SECRET=
ONE_ID_REDIRECT_URI=https://your-app.test/auth/one-id/callback

# Stateful OAuth protects browser flows by default. Enable stateless mode only
# when the client cannot retain a Laravel session across the redirect.
ONE_ID_STATELESS=false

The OneID authorization, token, and identity endpoints are configurable through ONE_ID_AUTHORIZATION_URL, ONE_ID_TOKEN_URL, and ONE_ID_USER_URL. Their defaults point to the standard OneID SSO endpoint.

Usage

Your application owns the routes and decides what to do with the identity:

use Illuminate\Support\Facades\Route;
use Laravel\Socialite\Facades\Socialite;

Route::get('/auth/one-id/redirect', function () {
    return Socialite::driver('one_id')->redirect();
});

Route::get('/auth/one-id/callback', function () {
    $oneIdUser = Socialite::driver('one_id')->user();

    // Match, persist, or authenticate the user in application code.
    // $oneIdUser->getId()
    // $oneIdUser->getName()
    // $oneIdUser->pin
    // $oneIdUser->passport_number
});

The mapped Socialite user exposes these OneID-specific attributes when the service returns them:

  • pin
  • passport_number
  • first_name
  • surname
  • middle_name
  • auth_method
  • pkcs_legal_tin

The complete provider response remains available through $oneIdUser->getRaw().

Stateless clients

State validation is enabled by default. Keep the redirect and callback routes in Laravel's web middleware group so the OAuth state can be stored in the session.

If a mobile or API client cannot retain that session, enable stateless mode:

ONE_ID_STATELESS=true

Development

composer install
composer format
composer test

License

MIT