PHPackages                             batiscaff/oauth2-bitrix24 - 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. batiscaff/oauth2-bitrix24

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

batiscaff/oauth2-bitrix24
=========================

Bitrix24 OAuth 2.0 Client Provider for The PHP League OAuth2-Client

v0.1.0(3y ago)0612↓50%11MITPHPPHP ^7.3 || ^8.0

Since Mar 27Pushed 2y ago1 watchersCompare

[ Source](https://github.com/Batiscaff/oauth2-bitrix24)[ Packagist](https://packagist.org/packages/batiscaff/oauth2-bitrix24)[ RSS](/packages/batiscaff-oauth2-bitrix24/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (4)Versions (2)Used By (1)

Bitrix24 Provider for OAuth 2.0 Client
======================================

[](#bitrix24-provider-for-oauth-20-client)

This package provides Bitrix24 OAuth 2.0 support for the PHP League's [OAuth 2.0 Client](https://github.com/thephpleague/oauth2-client).

Installation
------------

[](#installation)

To install, use composer:

```
composer require batiscaff/oauth2-bitrix24

```

Usage
-----

[](#usage)

Usage is similar to the basic OAuth client, using `\Batiscaff\OAuth2\Client\Provider\Bitrix24` as the provider.

### Authorization Code Flow

[](#authorization-code-flow)

```
$provider = new League\OAuth2\Client\Provider\Bitrix24([
    'domain'            => 'https://some-bitrix24-host.com',
    'clientId'          => '{bitrix24-client-id}',
    'clientSecret'      => '{bitrix24-client-secret}',
    'redirectUri'       => 'https://example.com/callback-url',
]);

if (!isset($_GET['code'])) {

    // If we don't have an authorization code then get one
    $authUrl = $provider->getAuthorizationUrl();
    $_SESSION['oauth2state'] = $provider->getState();
    header('Location: '.$authUrl);
    exit;

// Check given state against previously stored one to mitigate CSRF attack
} elseif (empty($_GET['state']) || ($_GET['state'] !== $_SESSION['oauth2state'])) {

    unset($_SESSION['oauth2state']);
    exit('Invalid state');

} else {

    // Try to get an access token (using the authorization code grant)
    $token = $provider->getAccessToken('authorization_code', [
        'code' => $_GET['code']
    ]);

    // Optional: Now you have a token you can look up a users profile data
    try {

        // We got an access token, let's now get the user's details
        $user = $provider->getResourceOwner($token);

        // Use these details to create a new profile
        printf('Hello %s!', $user->getName());
        printf('Your email: %s', $user->getEmail());

    } catch (Exception $e) {

        // Failed to get user details
        exit('Oh dear...');
    }

    // Use this to interact with an API on the users behalf
    echo $token->getToken();
}
```

### Managing Scopes

[](#managing-scopes)

When creating your Bitrix24 authorization URL, you can specify the state and scopes your application may authorize.

```
$options = [
    'state' => 'OPTIONAL_CUSTOM_CONFIGURED_STATE',
    'scope' => ['user','user.userfield','lists','im','iblock'] // array or string;
];

$authorizationUrl = $provider->getAuthorizationUrl($options);
```

If neither are defined, the provider will utilize internal defaults.

At the time of authoring this documentation, the [following scopes are available](https://dev.1c-bitrix.ru/learning/course/index.php?COURSE_ID=99&LESSON_ID=2280).

- bizproc
- calendar
- call
- catalog
- configuration.import
- contact\_center
- crm
- department
- disk
- documentgenerator
- crm.documentgenerator
- entity
- telephony
- im
- imbot
- imopenlines
- intranet
- landing
- lists
- log
- mailservice
- messageservice
- mobile
- pay\_system
- placement
- pull
- rpa
- sale
- sonet\_group
- task
- timeman
- user
- user\_brief
- user\_basic
- user.userfield
- userfieldconfig
- userconsent
- landing\_cloud
- delivery
- rating
- smile
- iblock
- configuration.import
- salescenter
- cashbox
- forum
- pull\_channel

Testing
-------

[](#testing)

```
$ ./vendor/bin/phpunit
```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](https://github.com/Batiscaff/oauth2-bitrix24/blob/master/LICENSE.md) for more information.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 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

Unknown

Total

1

Last Release

1139d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/dc248482746913756fe718cafa9e5e88184797c42b0765e762bc23201eb9bbcd?d=identicon)[Batiscaff](/maintainers/Batiscaff)

---

Top Contributors

[![stonehedge-deployer](https://avatars.githubusercontent.com/u/72932369?v=4)](https://github.com/stonehedge-deployer "stonehedge-deployer (1 commits)")

---

Tags

clientoauthoauth2authorizationauthorisationBitrix24

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/batiscaff-oauth2-bitrix24/health.svg)

```
[![Health](https://phpackages.com/badges/batiscaff-oauth2-bitrix24/health.svg)](https://phpackages.com/packages/batiscaff-oauth2-bitrix24)
```

###  Alternatives

[stevenmaguire/oauth2-keycloak

Keycloak OAuth 2.0 Client Provider for The PHP League OAuth2-Client

2275.9M27](/packages/stevenmaguire-oauth2-keycloak)[patrickbussmann/oauth2-apple

Sign in with Apple OAuth 2.0 Client Provider for The PHP League OAuth2-Client

1132.5M6](/packages/patrickbussmann-oauth2-apple)[mollie/oauth2-mollie-php

Mollie Provider for OAuth 2.0 Client

251.7M1](/packages/mollie-oauth2-mollie-php)[omines/oauth2-gitlab

GitLab OAuth 2.0 Client Provider for The PHP League OAuth2-Client

36721.5k13](/packages/omines-oauth2-gitlab)

PHPackages © 2026

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