Skip to content

Commit

Permalink
πŸ› fix: tg mini app login params (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
rustin01 authored Jul 31, 2024
1 parent 7d30bde commit 323b1ec
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion apps/wallet/src/utils/auth/providers/telegram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ export class TelegramAuthenticateProvider implements IAuthenticateProvider {
public authenticate: (launchParams?: any) => Promise<any> = 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
Expand All @@ -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)
},
Expand Down

0 comments on commit 323b1ec

Please sign in to comment.