mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-28 09:33:46 +00:00
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:
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user