debug: add early auth logging

This commit is contained in:
2026-02-07 04:39:54 +03:00
parent b79fb83447
commit 60a089daa5
4 changed files with 17 additions and 5 deletions
@@ -139,15 +139,20 @@ function verifySessionToken(token: string, botToken: string): number | null {
}
serve(async (req) => {
console.log('[telegram-auth] Request received:', req.method);
const corsHeaders = getCorsHeaders(req.headers.get('origin'));
// Handle CORS preflight
if (req.method === 'OPTIONS') {
console.log('[telegram-auth] CORS preflight');
return new Response('ok', { headers: corsHeaders });
}
try {
console.log('[telegram-auth] Parsing body...');
const body = await req.json();
console.log('[telegram-auth] Body parsed, initData:', body.initData ? 'exists' : 'missing');
const { initData, sessionToken } = body;
// Get environment variables