New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

smskin/laravel-tgwebapp-auth

Authentication guard for Telegram web app user integration
1,010 7

Larablocks Analysis

smskin/laravel-tgwebapp-auth works with Laravel 10 and 11 (latest release 1.0.5, Jan 20, 2025), all past end of life (the last on Mar 12, 2026): no more fixes, even for security.

Recommendation checks

Use with care

Use with care: meets 0 of 4 checks.

  • Supports only Laravel 10 and 11, past end of life since Mar 12, 2026
  • No release in the last 12 months (last: Jan 20, 2025)
  • 2 downloads a month (needs 10,000)
  • 7 GitHub stars (needs 100)

State

Quiet
  • Last stable release: Jan 20, 2025.
  • No releases in the last 12 months.
  • First released: Oct 23, 2024.
  • Monthly downloads: 2.
  • 1 open issue on GitHub.

Data from Packagist and GitHub, checked by Larablocks on Nov 30, 2026.

Install
composer require smskin/laravel-tgwebapp-auth
Latest Version:1.0.5
PHP:^8.1
Laravel:10 · 11
License:MIT
Last Updated:Sep 1, 2025
Links: GitHub  ·  Packagist
Maintainer: smskin

Telegram WebApp User Authentication Module

Telegram WebApp Documentation

Use Case: When developing an API for a Telegram WebApp, it is necessary to verify that the user who sent the request to the API is indeed the one they claim to be (i.e., the request actually came from the Telegram WebApp).

How It Works

  1. The Telegram WebApp JS script retrieves the WebAppUser object from the API and sends it in every request to the API in the request header (the header name is configurable).
  2. The Guard receives the request and extracts the WebAppUser object from it.
  3. The Guard verifies the data signature using the BOT_TOKEN.
  4. The Guard looks for the user in the database:
    1. If the user is found, they are authenticated.
    2. If the user is not found:
      1. If automatic user creation is allowed, the user will be created and authenticated.
      2. If automatic user creation is disabled, a 403 error is returned.

Configuration

In the config/auth.php file, the tgwebapp guard must be registered.

Example of the file content after registering the guard:

...
'guards' => [
    'web' => [
        'driver' => 'session',
        'provider' => 'users',
    ],
    'tgwebapp' => [
        'driver' => 'tgwebapp', // the name of the guard
        'token' => env('TELEGRAM_BOT_TOKEN'), // bot token
        'autoCreation' => true, // flag allowing automatic user creation
        'userDataHeaderName' => 'X-TELEGRAM-USER-DATA', // header name from which the guard retrieves the WebAppUser object
        'userModel' => \App\Models\User::class, // user model class
    ]
],
...

Usage

Include the guard in the routing file routes/web.php.

...
Route::middleware('auth:tgwebapp')->group(function(){
    Route::get('/me', function(){
        return 'Hello!';
    });
});
...

A GET request to /me will go through authentication via the Telegram WebApp guard.

Alternatives to smskin/laravel-tgwebapp-auth

jeffersongoncalves/laravel-user

Base authenticatable User model, migration, factory and observer shared by the j...

8,402 1
brackets/admin-auth

Authentication interface for brackets/admin-ui

265,451 7
lab404/laravel-auth-checker

Laravel Auth Checker allows you to log users authentication, devices authenticat...

170,182 220
sven/super-basic-auth

A lightweight package to add basic authentication to your Laravel app.

4,342 23
sarav/laravel-multiauth

A Simple Laravel Package for handling multiple authentication

31,746 49

Version History

Version Released PHP Laravel License
1.0.5 ^8.1 ^10 || ^11 MIT
1.0.4 ^8.1 ^10 || ^11 MIT
1.0.3 ^8.1 ^10 || ^11 MIT
1.0.2 ^8.1 ^10 || ^11 MIT
1.0.1 ^8.1 ^10 || ^11 MIT