From 323b1ec5fb11b7701a3fdbad8ccac5e304def4d3 Mon Sep 17 00:00:00 2001 From: rustin01 <141540002+rustin01@users.noreply.github.com> Date: Wed, 31 Jul 2024 19:57:10 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20tg=20mini=20app=20login?= =?UTF-8?q?=20params=20(#63)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wallet/src/utils/auth/providers/telegram.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/wallet/src/utils/auth/providers/telegram.ts b/apps/wallet/src/utils/auth/providers/telegram.ts index 10a351f..57c6b65 100644 --- a/apps/wallet/src/utils/auth/providers/telegram.ts +++ b/apps/wallet/src/utils/auth/providers/telegram.ts @@ -28,7 +28,11 @@ export class TelegramAuthenticateProvider implements IAuthenticateProvider { public authenticate: (launchParams?: any) => Promise = async (launchParams?: string) => { // mini app if (launchParams) { - window.location.href = `${AUTH_SERVER_URL}Telegram/Login?tgWebAppData=${launchParams}` + // const query = location.hash.slice(1) + // window.location.href = `${AUTH_SERVER_URL}Telegram/Login?${query}` + sessionStorage.removeItem('telegram-apps/launch-params') + window.location.href = `${AUTH_SERVER_URL}Telegram/Login?tgWebAppData=${encodeURIComponent(launchParams)}&returnUrl=${encodeURIComponent(`${location.origin}/oidc-login`)}` + return } // web login @@ -45,6 +49,7 @@ export class TelegramAuthenticateProvider implements IAuthenticateProvider { // delete userData.auth_date // const queryValue = `user=${encodeURIComponent(JSON.stringify(userData))}&auth_date=${data.auth_date}&hash=${data.hash}` const queryValue = objToQuery(data) + sessionStorage.removeItem('telegram-apps/launch-params') window.location.href = `${AUTH_SERVER_URL}Telegram/WebLogin?${queryValue}&returnUrl=${encodeURIComponent(`${location.origin}/oidc-login`)}` resolve(true) },