stuff
Some checks are pending
Backend CI / test (push) Waiting to run
Backend CI / build (push) Blocked by required conditions
Web App CI / test (push) Waiting to run
Web App CI / build (push) Blocked by required conditions
Deploy Mnemo Cards / Deploy Backend (push) Waiting to run
Deploy Mnemo Cards / Deploy Web App (push) Blocked by required conditions
Deploy Mnemo Cards / Final Verification (push) Blocked by required conditions

This commit is contained in:
Dmitry 2025-12-17 05:27:22 +03:00
parent 79692cf6f9
commit 3afd853f15
2 changed files with 17 additions and 3 deletions

View file

@ -238,17 +238,26 @@ class AuthApiV2 {
Future<Response> authenticateTelegramWebApp(Request request) async {
try {
final body = await request.readAsString();
log('Telegram Web App auth request body: ${body.length} chars', name: 'AuthApiV2');
log('Telegram Web App auth request body length: ${body.length} chars', name: 'AuthApiV2');
log('Telegram Web App auth request body (first 200 chars): ${body.length > 200 ? body.substring(0, 200) : body}', name: 'AuthApiV2');
Map<String, dynamic> json;
try {
json = jsonDecode(body) as Map<String, dynamic>;
} catch (e, s) {
log('Telegram Web App auth: Failed to parse JSON body: $e', error: e, stackTrace: s, name: 'AuthApiV2');
return _badRequest('Invalid JSON in request body: $e');
}
final json = jsonDecode(body) as Map<String, dynamic>;
final initData = json['initData'] as String?;
if (initData == null || initData.isEmpty) {
log('Telegram Web App auth: initData is null or empty', name: 'AuthApiV2');
log('Telegram Web App auth: initData is null or empty. JSON keys: ${json.keys.toList()}', name: 'AuthApiV2');
return _badRequest('Telegram Web App init data is required');
}
log('Telegram Web App auth: initData received, length: ${initData.length}', name: 'AuthApiV2');
log('Telegram Web App auth: initData preview (first 100 chars): ${initData.length > 100 ? initData.substring(0, 100) : initData}', name: 'AuthApiV2');
// Use the existing telegram utils to get user ID
final telegramUtils = TelegramUtils();

View file

@ -430,6 +430,11 @@ class HttpRepositoryV2 {
return null;
} on DioException catch (e) {
log(
'Telegram Web App auth DioException: ${e.response?.statusCode}, '
'message: ${e.message}, data: ${e.response?.data}',
name: 'HttpRepositoryV2',
);
if (e.error is ApiException) {
rethrow;
}