Enable Telegram authentication in the Privy
Dashboard before implementing
this feature.
Privy also enables seamless login within Telegram, so users can zero-click authenticate to your
Telegram bot or mini-app. Check out our recipe for setting up seamless login with
Telegram.
To authenticate your users with Privy’s out of the box UIs, check out UI components here.
useLoginWithTelegram
hook.Usage
Before using the
useLoginWithTelegram
hook, ensure that Telegram is enabled in Socials tab of the Login Methods page on the the Privy dashboardTracking Flow State
Track the state of the Telegram authentication flow via thestate
variable returned by the
useLoginWithTelegram
hook.The current state of the Telegram authentication flow.
The error that occurred during the Telegram authentication flow.
Callbacks
You can optionally pass callbacks into theuseLoginWithTelegram
hook to run custom logic after a successful login or to handle errors that occur during the flow.onComplete
Parameters
The user object corresponding to the authenticated user.
Whether the user is a new user or an existing user.
Whether the user entered the application already authenticated.
The method used by the user to login.
The account corresponding to the loginMethod used.
onError
Parameters
The error that occurred during the login flow.