PHPackages                             nodeloc/oauth2-telegram - 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. nodeloc/oauth2-telegram

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

nodeloc/oauth2-telegram
=======================

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

1.0.2(2y ago)01281MITPHPPHP ^8.0

Since Jan 24Pushed 2y ago1 watchersCompare

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

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

Telegram Provider for OAuth 2.0 Client
======================================

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

[![Latest Version](https://camo.githubusercontent.com/d3006c5ac31b5f7876ded51f8e19c14ed06debb8b5c879a1c817269f32a966bb/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f6e6f64656c6f632f6f61757468322d54656c656772616d2e7376673f7374796c653d666c61742d737175617265)](https://github.com/nodeloc/oauth2-Telegram/releases)[![Build Status](https://camo.githubusercontent.com/12f1bf4ad185e3dcc85efe4e2e26ceca2cf581f529a0566b7663c50b8a1dc61b/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6e6f64656c6f632f6f61757468322d54656c656772616d2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/nodeloc/oauth2-Telegram)[![Total Downloads](https://camo.githubusercontent.com/dc9f1689422976ac4534f602ef95a2eb7599a98e731651ee419884022b1d5bc0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e6f64656c6f632f6f61757468322d54656c656772616d2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/nodeloc/oauth2-Telegram)

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

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

[](#installation)

To install the package, use composer:

```
composer require nodeloc/oauth2-telegram

```

Usage
-----

[](#usage)

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

### Authorization Code Flow

[](#authorization-code-flow)

```
$provider = new Nodeloc\OAuth2\Client\Provider\Telegram([
    'clientId'          => '{Telegram-client-id}',
    'clientSecret'      => '{Telegram-client-secret}',
    'redirectUri'       => 'https://example.com/callback_url',
]);

// Send OAuth Request
// If we don't have an authorization code then we can get one
$authUrl = $provider->getAuthorizationUrl();
$_SESSION['OAuth2State'] = $provider->getState();

...

// OAuth2 Callback URL
// Compare given state against previously stored one to block CSRF attack
if (empty($_GET['state']) || ($_GET['state'] !== $_SESSION['OAuth2State'])) {

    exit('Invalid state');

} else {

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

    // Now we can look up users profile
    try {
        // Get the user's details
        $user = $provider->getResourceOwner($token);

        printf('Hello %s!', $user->getName());

    } catch (Exception $e) {
        // Failed to get user details
        exit('Oh no ... ...');
    }

    // We can use token to make other API calls
    echo $token->getToken();
}
```

Testing
-------

[](#testing)

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

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity48

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

3

Last Release

836d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/292e61641461fc29e1fa80bdb00256983c9d19a56636f5eee78a964f68f2eabe?d=identicon)[nodeloc](/maintainers/nodeloc)

---

Top Contributors

[![nodeloc](https://avatars.githubusercontent.com/u/149086144?v=4)](https://github.com/nodeloc "nodeloc (3 commits)")

---

Tags

clientAuthenticationoauthoauth2authorizationtelegram

### Embed Badge

![Health badge](/badges/nodeloc-oauth2-telegram/health.svg)

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

###  Alternatives

[league/oauth2-google

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

41721.2M118](/packages/league-oauth2-google)[cakedc/oauth2-cognito

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

18597.7k](/packages/cakedc-oauth2-cognito)

PHPackages © 2026

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