-
Notifications
You must be signed in to change notification settings - Fork 1
Closed
Description
Hi,
When using @telegram-login-ultimate/react in my application, the success callback occasionally returns a boolean value instead of the expected user information object. This behavior seems inconsistent and is hard to reproduce reliably.
To Reproduce:
Integrate @telegram-login-ultimate/react in a React app.
Trigger the Telegram login flow.
Observe that in some cases, the success callback receives a boolean instead of the user info object.
Expected behavior
The success callback should always return the Telegram user info object upon successful login.
import { useState } from 'react';
import { type TelegramLoginData, useTelegramLogin } from '@telegram-login-ultimate/react';
import { Button } from '@/shared/ui/button';
import { toast } from '@/shared/ui/sonner';
export const TelegramConnect = () => {
const [tgUser, setTgUser] = useState<TelegramLoginData>();
const [openPopup, { isPending }] = useTelegramLogin({
botId: 'YOUR_BOT_ID',
onSuccess: (user) => handleSuccess(user),
onFail: () => handleFail(),
});
const handleSuccess = async (user: TelegramLoginData) => {
setTgUser(user);
toast.success('Telegram login successful');
};
const handleFail = async () => {
toast.error('Telegram login failed');
};
return (
<Button disabled={isPending} onClick={openPopup}>
{tgUser ? `@${tgUser.username}` : 'Connect Telegram'}
</Button>
);
};Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels