PHPackages                             beeralex/beeralex.oauth2 - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. beeralex/beeralex.oauth2

ActiveBitrix-module[Authentication &amp; Authorization](/categories/authentication)

beeralex/beeralex.oauth2
========================

v1.1.0(3mo ago)01MITPHP

Since Oct 11Pushed 3mo agoCompare

[ Source](https://github.com/BkycHblu-6oPwuK/beeralex.oauth2)[ Packagist](https://packagist.org/packages/beeralex/beeralex.oauth2)[ RSS](/packages/beeralex-beeralexoauth2/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (2)Versions (8)Used By (0)

Установка
=========

[](#установка)

добавьте в composer.json экстра опцию, чтобы композер поставил пакет в local/modules

```
"extra": {
  "installer-paths": {
    "local/modules/{$name}/": ["type:bitrix-module"]
  }
}
```

Необходимо выполнить команду `composer require beeralex/beeralex.oauth2`, и выполнить установку модуля в Bitrix через админку (сначала должен быть установлен beeralex.core).

Конфигурация
============

[](#конфигурация)

Для начала необходимо сгенерировать публичный и приватный ключи:

```
openssl genpkey -algorithm RSA -out private.key

openssl rsa -pubout -in private.key -out public.key
```

и ключ шифрования:

```
php -r 'echo base64_encode(random_bytes(32)), PHP_EOL;'
```

Далее в один из файлов конфигурации (`.settings.php`, `.settings_extra.php`) добавьте следующие настройки:

```
return [
    ...
    'beeralex.oauth2' => [
        'value' => [
            'private_key' => '/path/to/private.key', // здесь абсолютный путь
            'public_key' => '/path/to/public.key', // здесь абсолютный путь
            'private_key_passphrase' => null,
            'encryption_key' => 'lxZFUEsBCJ2Yb14IF2ygAHI5N4+ZAUXXaSeeJm6+twsUmIen', // ключ шифрования
        ]
    ],
    ...
]
```

В конце добавьте роуты `routes/oauth.php` из модуля, в свой `outes/web.php`:

Scopes
======

[](#scopes)

Для работы со скоупами доступа к API необходимо подписаться на событие `OnScopesLoad`:

```
use Bitrix\Main;

Main\EventManager::getInstance()->addEventHandler(
    'beeralex.oauth2',
    'OnScopesLoad',
    static function (Main\Event $event): Main\EventResult {
        return new Main\EventResult(Main\EventResult::SUCCESS, [
            'read' => 'Read site data',
            'write' => 'Write site data',
        ]);
    }
);
```

Создание клиентов
=================

[](#создание-клиентов)

для добавления клиентов перейдите в админку, вкладка сервисы и в меню найдите `OAuth2` и добавьте клиента.

Примеры запросов
================

[](#примеры-запросов)

Для авторизации по типу client\_credentials достаточно передать 3 параметра:

1. grant\_type = “client\_credentials”
2. client\_id – клиент id из таблицы yngc0der\_oauth2server\_clients
3. client\_secret – не захешированный client\_secret из yngc0der\_oauth2server\_clients

Для авторизации по типу password нужно дополнительно передать еще два параметра:

1. Здесь grant\_type = “password”
2. client\_id
3. client\_secret
4. username – это LOGIN пользователя из таблицы bitrix (Bitrix\\Main\\UserTable)
5. password – так же незахешированный пароль пользователя из таблицы bitrix

Authorization code grant
------------------------

[](#authorization-code-grant)

> GET [https://my.site.com/oauth/authorize?response\_type=code&amp;client\_id=00112233-4455-6677-8899-aabbccddeeff&amp;redirect\_uri=https://client.site.com&amp;scope=read&amp;state=test&amp;code\_challenge=WIwW8sZaGckIxtqi\_L2h4-Mgk06-X2ffV95NdDo1\_bw&amp;code\_challenge\_method=S256](https://my.site.com/oauth/authorize?response_type=code&client_id=00112233-4455-6677-8899-aabbccddeeff&redirect_uri=https://client.site.com&scope=read&state=test&code_challenge=WIwW8sZaGckIxtqi_L2h4-Mgk06-X2ffV95NdDo1_bw&code_challenge_method=S256)

> POST
>
> { "grant\_type": "authorization\_code", "code": "def5020018a310a188e28c17e1437fb8018bba5a32dd8d85ed9af40a761e40820353f21491b7382a2210d517acdf2987f8c01c3c0d8bc1853b26b90b1aa3df93b0d220b27b19b8593b1ae58bd5542ff224211bd729b8d80af4adb2e092e44c44e05d2c2856f062cb52f015583c1260e789e352c4e3f210b3026319cc0f8e46b4e1af1865a6d95b91ab02350d8ee2e416a95ea8b156b77b847a0ee0e4702ebbdec9ad4ce5397c8187be1e2c8c7f413f51f05274558e150c4cd4d9fa5c509a4d37f0c55a7291627ad3979932f0561645c5848a8497c65208563f6d2ef3fd91cad922ab6055998e33669d9874857a2bf64a9d802f0f84949c83dcc9fb20358ba9ca66ee4769c15d479283b75c711f4b26bb86775f5b01f9dc60bed43f8b1ddf4d64a2f371109a258070b68271b91294543f25b64d726c5e515143755bfcf1653e25727675821e7d6f8d250c97c4dad3a0e068bc9a8677dd71d143d682465544af170c44d1bf0ef23ee74b8c696a82516dcfebb30ae1ffd210c2e2acb35fc3a32f3ef7ced4a81431fa58ee774845205a7fdff3f907d7d83b553bd2079598c78ec5cf7af46d51e98589e70b2044868adb", "code\_verifier": "jWJS7olsI78LF-hcNHO1QBMqVX06iN5Z837vD6UXO3g", "redirect\_uri": "", "client\_id": "00112233-4455-6677-8899-aabbccddeeff" }

проверка private.key
====================

[](#проверка-privatekey)

используйте метод `Beeralex\Oauth2\PrivateKeyChecker::check` для проверки правильности установки ключа.

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance81

Actively maintained with recent releases

Popularity1

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~18 days

Recently: every ~24 days

Total

7

Last Release

103d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/77bd3b8ad5192c498ba8d5a70ae80d7d73e8d13dda7989920a4fa47711fcb8c2?d=identicon)[BkycHblu-6oPwuK](/maintainers/BkycHblu-6oPwuK)

---

Top Contributors

[![BkycHblu-6oPwuK](https://avatars.githubusercontent.com/u/122775450?v=4)](https://github.com/BkycHblu-6oPwuK "BkycHblu-6oPwuK (10 commits)")

### Embed Badge

![Health badge](/badges/beeralex-beeralexoauth2/health.svg)

```
[![Health](https://phpackages.com/badges/beeralex-beeralexoauth2/health.svg)](https://phpackages.com/packages/beeralex-beeralexoauth2)
```

###  Alternatives

[web-auth/webauthn-lib

FIDO2/Webauthn Support For PHP

1195.3M72](/packages/web-auth-webauthn-lib)[web-auth/webauthn-framework

FIDO2/Webauthn library for PHP and Symfony Bundle.

50570.7k1](/packages/web-auth-webauthn-framework)[illuminate/auth

The Illuminate Auth package.

9327.3M1.0k](/packages/illuminate-auth)[jbtronics/2fa-webauthn

Webauthn Two-Factor-Authentication Plugin for scheb/2fa

1541.7k](/packages/jbtronics-2fa-webauthn)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
