Migrating Telegram Mini App to MatchID
Overview
MatchID provides a solution to run your Telegram Mini App independently on your website with little or no efforts, allowing you to leverage MatchID as an authentication and user management solution within your App.
Why Migrate?
The Telegram Mini App is a mini-program based on Telegram, designed to create and run applications within Telegram. However, due to its limitations, you may encounter the following issues:
- The Telegram Mini App cannot be used outside of Telegram ecosystem.
- The Telegram Mini App requires DApps to migrate to the TON ecosystem.
Migration Steps
- Integrate using our React SDK.
- Code a simple login page and place a login button on it. When the login button is tapped, call the
login('telegram')
method fromuseUserInfo
. - Listen for the user login success event using one of the following methods:
- Use
useMatchEvents
to listen for theonLogin
event. - Use the
events
parameter inMatchProvider
to listen for theonLogin
event. - Monitor changes in the
isLogin
state fromuseUserInfo
(recommended).
- Use
- Once logged in, request user authorization for Telegram information by calling the
getAuthInfo('telegram')
method fromuseUserInfo
. - The DApp frontend will then retrieve the authorized information and send it to the DApp backend.
- The DApp backend calls the
Get user auth info
API, passing in the data obtained in step 5. - After verification, you will receive the following Telegram information:
platformId
: The user's Telegram ID.firstName
: The user's Telegramfirst_name
.lastName
: The user's Telegramlast_name
.nickname
: The user's Telegramusername
.avatarUrl
: The user's Telegramavatar_url
.matchId
: The user's MatchID.
- This is how you can use MatchID as an authentication and user management solution in your App. Plus, you are given the flexibility to choose to migrate to MatchID's SSO login or keep the Telegram account login.