ijodkor/one-id

OneId OAuth package for Laravel/PHP

v1.0.1 2025-01-22 04:34 UTC

This package is not auto-updated.

Last update: 2025-01-22 04:37:51 UTC


README

Yagona identifikatsiya tizimi (Single identification system)

Talablar (Requirements)

  • PHP ^8.0
  • Laravel ^10

O‘rnatish (Installation)

Install the package via composer:

composer require ijodkor/one-id

Sozlash (Setup)

  1. Muhit o‘zgaruvchilari o‘rnatilinadi (Set environment variables)
ONE_ID_SSO_URL=<one_id_sso_url>
ONE_ID_CLIENT_ID=<client_id>
ONE_ID_CLIENT_SECRET=<client_secret>
  • Sozlama fayli yaratilinadi (Set Config file)
    /*
    |--------------------------------------------------------------------------
    | OneId Integration
    |--------------------------------------------------------------------------
    | This is the OneId package
    |
    */
    'one_id_sso_url' => env('ONE_ID_SSO_URL'),
    'one_id_client_id' => env('ONE_ID_CLIENT_ID'),
    'one_id_client_secret' => env('ONE_ID_CLIENT_SECRET'),
    'one_id_client_scope' => env('ONE_ID_CLIENT_SCOPE'),

Qo‘shimcha sozlamalar (Extra configurations)

ONE_ID_CLIENT_SCOPE=test
ONE_ID_CLIENT_STATE=test

Web - for monolith website and systems

  • php artisan one-id:api-make
  • Define following route in web.php
Route::get('/one-id/access', [OneIdWebAuthController::class, 'access']);

Api - for REST api website and systems

  • php artisan one-id:web-make
  • Define following route in api.php
Route::get('/auth/token', [OneIdAuthController::class, 'token']);

Ishlatish (Usage)

  • Api - those urls is ready to use
    • [POST] /api/one-id/url (name: one-id.url, )
  • Web - those urls is ready to use
    • [GET] /one-id/login (name: one-id.login)

Foydalanilgan manbalar (References)

Havolalar (Links)