feat: TelegramLoginButton with OIDC popup + legacy widget fallback

- Add oidc_enabled/oidc_client_id to TelegramWidgetConfig interface and fallback
- Add loginTelegramOIDC API method for id_token auth
- Add loginWithTelegramOIDC to auth store
- Rewrite TelegramLoginButton: OIDC popup when enabled, legacy widget otherwise
- Extend Window.Telegram type with Login SDK in vite-env.d.ts
This commit is contained in:
Fringg
2026-03-07 02:37:12 +03:00
parent 2c65ca8a7f
commit 91f0e9e2fc
5 changed files with 142 additions and 7 deletions

15
src/vite-env.d.ts vendored
View File

@@ -19,8 +19,23 @@ interface TelegramWebAppGlobal {
offEvent?: (event: string, callback: () => void) => void;
}
/** Telegram Login JS SDK — loaded from https://oauth.telegram.org/js/telegram-login.js */
interface TelegramLoginGlobal {
init: (
options: {
client_id: string;
request_access?: string[];
lang?: string;
},
callback: (data: { id_token?: string; user?: Record<string, unknown>; error?: string }) => void,
) => void;
open: () => void;
auth: () => void;
}
interface Window {
Telegram?: {
WebApp?: TelegramWebAppGlobal;
Login?: TelegramLoginGlobal;
};
}