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

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

juliaaan1/oauth2-bitrix24
=========================

Bitrix24 OAuth 2.0 support for the PHP League's OAuth 2.0 Client

1.0.1(3mo ago)01MITPHPPHP ^8.3

Since Mar 14Pushed 3mo agoCompare

[ Source](https://github.com/Juliaaan1/oauth2-bitrix24)[ Packagist](https://packagist.org/packages/juliaaan1/oauth2-bitrix24)[ RSS](/packages/juliaaan1-oauth2-bitrix24/feed)WikiDiscussions master Synced 3w ago

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

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

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

This package provide 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 juliaaan1/oauth2-bitrix24
```

Usage
-----

[](#usage)

Usage is the same as The League's OAuth client, using `\Juliaaan1\OAuth2\Client\Provider\Bitrix24` as the provider.

### Obtaining Client ID and Client Secret from Bitrix24

[](#obtaining-client-id-and-client-secret-from-bitrix24)

1. Navigate to the Developer section (`/devops/`).
2. Create a new local application (`Other` -&gt; `Local application`).
3. Fill in the application details:
    - Application type: Select `Server`
    - Handler path: Enter the full URL to the callback route on your server.
    - Script only (no user interface)
    - Assign permissions: `Users (minimum) (user_brief)`

Note

The `Handler path` defines the `redirect_uri` used in the OAuth flow.

4. Save the application. After saving, the page will display your `Client ID` and `Client Secret`.

### Authorization Code Flow

[](#authorization-code-flow)

```
$provider = new \Juliaaan1\OAuth2\Client\Provider\Bitrix24([
    'clientId' => '{bitrix24-client-id}',
    'clientSecret' => '{bitrix24-client-secret}',
    'bitrix24domain' => '{bitrix24-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->getId());
    } catch (Exception $e) {
        // Failed to get user details
        exit($e->getMessage());
    }

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

Testing
-------

[](#testing)

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

License
-------

[](#license)

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

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance80

Actively maintained with recent releases

Popularity1

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity50

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 ~0 days

Total

2

Last Release

103d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1b560afaca4f20da4a9185debca46919292851d93caf5f54c6ab5234b9cfc592?d=identicon)[Juliaaan1](/maintainers/Juliaaan1)

---

Top Contributors

[![Juliaaan1](https://avatars.githubusercontent.com/u/49025953?v=4)](https://github.com/Juliaaan1 "Juliaaan1 (2 commits)")

---

Tags

phpclientAuthenticationbitrixoauthoauth2authorizationBitrix24

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[league/oauth2-google

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

42222.6M157](/packages/league-oauth2-google)[league/oauth2-facebook

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

32213.6M79](/packages/league-oauth2-facebook)[andalisolutions/oauth2-anaf

Anaf OAuth 2.0 support for the PHP League's OAuth 2.0 Client

195.9k](/packages/andalisolutions-oauth2-anaf)

PHPackages © 2026

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