PHPackages                             e4se/laravel-telegram-oidc - 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. e4se/laravel-telegram-oidc

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

e4se/laravel-telegram-oidc
==========================

OpenID Telegram Connect OAuth2 Provider for Laravel Socialite

v1.1.0(2mo ago)2920[1 issues](https://github.com/e4se/laravel-telegram-oidc/issues)MITPHPPHP ^8.1

Since Mar 3Pushed 2mo agoCompare

[ Source](https://github.com/e4se/laravel-telegram-oidc)[ Packagist](https://packagist.org/packages/e4se/laravel-telegram-oidc)[ Docs](https://github.com/e4se/laravel-telegram-oidc)[ RSS](/packages/e4se-laravel-telegram-oidc/feed)WikiDiscussions main Synced today

READMEChangelog (2)Dependencies (9)Versions (9)Used By (0)

OpenID Telegram Connect (OIDC) Provider for Laravel Socialite
=============================================================

[](#openid-telegram-connect-oidc-provider-for-laravel-socialite)

[![Laravel Support: v9, v10, v11, v12](https://camo.githubusercontent.com/98eead3124e6bdece061a21911ea0201c7e1e8d84d14cb19d0a663f833cdcca9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c253230537570706f72742d76392532432532307631302532432532307631312532432532307631322d626c7565)](https://camo.githubusercontent.com/98eead3124e6bdece061a21911ea0201c7e1e8d84d14cb19d0a663f833cdcca9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c253230537570706f72742d76392532432532307631302532432532307631312532432532307631322d626c7565) [![PHP Support: 8.1, 8.2, 8.3](https://camo.githubusercontent.com/7446a90723f3f06194bc686845a81275f2a55230681af9c10579574b5aed418c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f504850253230537570706f72742d382e31253243253230382e32253243253230382e332d626c7565)](https://camo.githubusercontent.com/7446a90723f3f06194bc686845a81275f2a55230681af9c10579574b5aed418c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f504850253230537570706f72742d382e31253243253230382e32253243253230382e332d626c7565)

Installation &amp; Basic Usage
------------------------------

[](#installation--basic-usage)

```
composer require e4se/laravel-telegram-oidc
```

Please see the [Base Installation Guide](https://socialiteproviders.com/usage/), then follow the provider specific instructions below.

This provider implements Telegram's current OpenID Connect login flow documented at [core.telegram.org/bots/telegram-login](https://core.telegram.org/bots/telegram-login).

### Telegram setup

[](#telegram-setup)

Before configuring Laravel, make sure your bot is prepared in Telegram:

- Open `@BotFather` and navigate to `Bot Settings > Web Login`
- Register every allowed website origin and callback URL you plan to use
- Copy the `Client ID` and `Client Secret` shown by BotFather

Telegram only accepts login requests and redirects for pre-registered URLs.

### Add configuration to `config/services.php`

[](#add-configuration-to-configservicesphp)

```
'telegram-oidc' => [
    'client_id' => env('TELEGRAM_OIDC_CLIENT_ID'),
    'client_secret' => env('TELEGRAM_OIDC_CLIENT_SECRET'),
    'redirect' => env('TELEGRAM_OIDC_REDIRECT_URI'),
],
```

### Add provider event listener

[](#add-provider-event-listener)

Configure the package's listener to listen for `SocialiteWasCalled` events.

#### Laravel 11+

[](#laravel-11)

In Laravel 11, the default `EventServiceProvider` provider was removed. Instead, add the listener using the `listen` method on the `Event` facade, in your `AppServiceProvider` `boot` method.

```
Event::listen(function (\SocialiteProviders\Manager\SocialiteWasCalled $event) {
    $event->extendSocialite('telegram-oidc', \SocialiteProviders\TelegramOIDC\Provider::class);
});
```

#### Laravel 10 or below

[](#laravel-10-or-below)

Add the event to your listen\[\] array in `app/Providers/EventServiceProvider`. See the [Base Installation Guide](https://socialiteproviders.com/usage/) for detailed instructions.

```
protected $listen = [
    \SocialiteProviders\Manager\SocialiteWasCalled::class => [
        // ... other providers
        \SocialiteProviders\TelegramOIDC\TelegramOIDCExtendSocialite::class.'@handle',
    ],
];
```

### Usage

[](#usage)

You should now be able to use the provider like you would regularly use Socialite (assuming you have the facade installed):

```
return Socialite::driver('telegram-oidc')->redirect();
```

By default the provider uses PKCE (`S256`) and validates the returned `id_token` against Telegram's JWKS, including `iss`, `aud`, and `exp`, as required by the official documentation.

### Returned User fields

[](#returned-user-fields)

- `id`
- `name`
- `nickname`
- `avatar`

More fields are available under the `user` subkey:

```
$user = Socialite::driver('telegram-oidc')->user();

$phone_number = $user->user['phone_number'];
```

Telegram returns user claims directly in the `id_token`. Telegram does not currently expose a separate `userinfo` endpoint, so this provider reads the authenticated user from the validated ID token instead.

### Customizing the scopes

[](#customizing-the-scopes)

You may extend the default scopes (`openid profile`) by adding a `scopes` option to your OIDC service configuration and separate multiple scopes with a space. Telegram currently documents `phone` and `telegram:bot_access` as additional available scopes:

```
'telegram-oidc' => [
    'client_id' => env('TELEGRAM_OIDC_CLIENT_ID'),
    'client_secret' => env('TELEGRAM_OIDC_CLIENT_SECRET'),
    'redirect' => env('TELEGRAM_OIDC_REDIRECT_URI'),
    'scopes' => 'phone',
    // or
    'scopes' => env('TELEGRAM_OIDC_SCOPES'),
],
```

### PKCE

[](#pkce)

PKCE is enabled by default to match Telegram's recommended authorization code flow. If you need to disable it for compatibility testing, you can do so explicitly:

```
'telegram-oidc' => [
    'client_id' => env('TELEGRAM_OIDC_CLIENT_ID'),
    'client_secret' => env('TELEGRAM_OIDC_CLIENT_SECRET'),
    'redirect' => env('TELEGRAM_OIDC_REDIRECT_URI'),
    'use_pkce' => false,
],
```

### Proxy and HTTP timeouts

[](#proxy-and-http-timeouts)

You may route Telegram OIDC requests through a proxy directly from the provider config:

```
'telegram-oidc' => [
    'client_id' => env('TELEGRAM_OIDC_CLIENT_ID'),
    'client_secret' => env('TELEGRAM_OIDC_CLIENT_SECRET'),
    'redirect' => env('TELEGRAM_OIDC_REDIRECT_URI'),
    'proxy' => env('TELEGRAM_OIDC_PROXY', env('TELEGRAM_PROXY')),
    'connect_timeout' => env('TELEGRAM_OIDC_CONNECT_TIMEOUT'),
    'timeout' => env('TELEGRAM_OIDC_TIMEOUT'),
],
```

For advanced transport customization you can still pass raw Guzzle options via `guzzle`. Explicit `guzzle` options take precedence over the top-level `proxy`, `connect_timeout`, and `timeout` keys:

```
'telegram-oidc' => [
    'client_id' => env('TELEGRAM_OIDC_CLIENT_ID'),
    'client_secret' => env('TELEGRAM_OIDC_CLIENT_SECRET'),
    'redirect' => env('TELEGRAM_OIDC_REDIRECT_URI'),
    'proxy' => env('TELEGRAM_OIDC_PROXY'),
    'guzzle' => array_filter([
        'proxy' => env('TELEGRAM_OIDC_GUZZLE_PROXY'),
        'verify' => env('TELEGRAM_OIDC_VERIFY_TLS', true),
    ], static fn ($value) => $value !== null && $value !== ''),
],
```

---

Based on the work of [Kovah](https://github.com/Kovah)

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance75

Regular maintenance activity

Popularity23

Limited adoption so far

Community6

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

Total

8

Last Release

80d ago

Major Versions

v0.0.6 → v1.0.02026-03-03

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/20152014?v=4)[Alexander Morozov](/maintainers/e4se)[@e4se](https://github.com/e4se)

---

Top Contributors

[![e4se](https://avatars.githubusercontent.com/u/20152014?v=4)](https://github.com/e4se "e4se (11 commits)")

---

Tags

laravelprovideroauthsocialitetelegramoidc

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/e4se-laravel-telegram-oidc/health.svg)

```
[![Health](https://phpackages.com/badges/e4se-laravel-telegram-oidc/health.svg)](https://phpackages.com/packages/e4se-laravel-telegram-oidc)
```

###  Alternatives

[kovah/laravel-socialite-oidc

OpenID Connect OAuth2 Provider for Laravel Socialite

24133.8k](/packages/kovah-laravel-socialite-oidc)[laravel/socialite

Laravel wrapper around OAuth 1 &amp; OAuth 2 libraries.

5.7k108.5M885](/packages/laravel-socialite)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[socialiteproviders/apple

Apple OAuth2 Provider for Laravel Socialite

629.5M15](/packages/socialiteproviders-apple)[socialiteproviders/microsoft

Microsoft OAuth2 Provider for Laravel Socialite

347.3M25](/packages/socialiteproviders-microsoft)[api-platform/laravel

API Platform support for Laravel

58171.6k14](/packages/api-platform-laravel)

PHPackages © 2026

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