Closed NihilIF closed 8 months ago
Can you share code from your app/Http/Kernel.php
file?
`<?php
namespace App\Http;
use Illuminate\Foundation\Http\Kernel as HttpKernel;
class Kernel extends HttpKernel { /**
@var array<int, class-string|string> */ protected $middleware = [ // \App\Http\Middleware\TrustHosts::class, \App\Http\Middleware\TrustProxies::class, \Illuminate\Http\Middleware\HandleCors::class, \App\Http\Middleware\PreventRequestsDuringMaintenance::class, \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class, \App\Http\Middleware\TrimStrings::class, \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class, ];
/**
@var array<string, array<int, class-string|string>> */ protected $middlewareGroups = [ 'web' => [ \App\Http\Middleware\EncryptCookies::class, \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, \Illuminate\Session\Middleware\StartSession::class, \Illuminate\View\Middleware\ShareErrorsFromSession::class, \App\Http\Middleware\VerifyCsrfToken::class, \Illuminate\Routing\Middleware\SubstituteBindings::class, ],
'api' => [
// \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
\Illuminate\Routing\Middleware\ThrottleRequests::class.':api',
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
];
/**
PHP version
8.1
irazasyed/telegram-bot-sdk version
3.13
Laravel version (if any)
10.44.0
Code To Reproduce the bug
StartCommand.php
namespace App\Console\Commands\Telegram;
use Telegram\Bot\Commands\Command;
class StartCommand extends Command { protected string $name = 'start'; protected string $description = 'Iniciar bot para presentarse';
}
My controller function
public function activarWebhook(Request $request) { $update = Telegram::commandsHandler(true); return 'ok'; }
my route in api.php
Route::post('/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxl/webhook', [TelegramControlador::class, 'activarWebhook']);
Error stacktrace (if any)
Getting a 403 error from my server in CPanel when I try to run a command from my telegram bot. I don't understand what's happening, my route is in api.php so I shouldn't need the CSRF