feat: deep link авторизация при блокировке oauth.telegram.org

Добавлен fallback через бота когда виджет Telegram не загружается:
- Таймаут 8 сек на загрузку скрипта (OIDC + legacy)
- Автоматический переход на deep link auth
- Polling каждые 2.5 сек до подтверждения в боте
- ConnectedAccounts: таймаут + сообщение при недоступности
- Переводы: ru, en, zh, fa
This commit is contained in:
Fringg
2026-03-17 21:29:21 +03:00
parent 77b3a157e8
commit 6a1a9f5db7
8 changed files with 349 additions and 18 deletions

View File

@@ -45,6 +45,7 @@ interface AuthState {
state: string,
deviceId?: string | null,
) => Promise<void>;
loginWithDeepLink: (token: string) => Promise<void>;
registerWithEmail: (
email: string,
password: string,
@@ -318,6 +319,19 @@ export const useAuthStore = create<AuthState>()(
await get().checkAdminStatus();
},
loginWithDeepLink: async (token) => {
const response = await authApi.pollDeepLinkToken(token);
tokenStorage.setTokens(response.access_token, response.refresh_token);
set({
accessToken: response.access_token,
refreshToken: response.refresh_token,
user: response.user,
isAuthenticated: true,
pendingCampaignBonus: response.campaign_bonus || null,
});
await get().checkAdminStatus();
},
registerWithEmail: async (email, password, firstName, referralCode) => {
const code = referralCode || consumeReferralCode() || undefined;
const response = await authApi.registerEmailStandalone({