smskin/laravel-tgwebapp-auth
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 careUse 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 |
Telegram WebApp User Authentication Module
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
- 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).
- The Guard receives the request and extracts the WebAppUser object from it.
- The Guard verifies the data signature using the BOT_TOKEN.
- The Guard looks for the user in the database:
- If the user is found, they are authenticated.
- If the user is not found:
- If automatic user creation is allowed, the user will be created and authenticated.
- 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
Base authenticatable User model, migration, factory and observer shared by the j...
Laravel Auth Checker allows you to log users authentication, devices authenticat...
A lightweight package to add basic authentication to your Laravel app.
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| 1.0.5 | ^8.1 | ^10 || | MIT | |
| 1.0.4 | ^8.1 | ^10 || | MIT | |
| 1.0.3 | ^8.1 | ^10 || | MIT | |
| 1.0.2 | ^8.1 | ^10 || | MIT | |
| 1.0.1 | ^8.1 | ^10 || | MIT | |
| 1.0.0 | ^8.1 | ^10 || | MIT |