Skip to content

Configuration

The TelegramLoginConfiguration class defines all the parameters needed to configure the Telegram Login SDK.

FieldTypeRequiredDescription
clientIdStringYesThe numeric bot client ID from BotFather.
redirectUriStringYesEither https://app{id}-login.tg.dev (Universal/App Link) or yourscheme://path.
scopesList<String>YesOAuth scopes, e.g. ['profile'].
fallbackSchemeString?NoCustom URL scheme used on iOS < 17.4 when redirectUri is an https:// URL.
const TelegramLoginConfiguration(
clientId: '12345',
redirectUri: 'https://app12345-login.tg.dev',
scopes: ['profile'],
)
const TelegramLoginConfiguration(
clientId: '12345',
redirectUri: 'https://app12345-login.tg.dev',
scopes: ['profile'],
fallbackScheme: 'myapp', // Used on iOS < 17.4
)
const TelegramLoginConfiguration(
clientId: '12345',
redirectUri: 'myapp://auth',
scopes: ['profile'],
fallbackScheme: 'myapp',
)

You can request specific permissions when initiating authorization. The openid scope is required.

ScopeDescriptionClaims Returned
openidRequired. Returns the user’s unique identifier and auth timestamp.sub, iss, iat, exp
profileUser’s basic info: name, username, and profile photo URL.name, preferred_username, picture
phoneUser’s verified phone number. Requires user consent.phone_number
telegram:bot_accessAllows your bot to send direct messages to the user after login.
  • Universal Links require iOS 17.4+ and proper Associated Domains configuration
  • Custom URL Schemes work on all iOS versions but are less secure
  • When using Universal Links, always provide a fallbackScheme for older iOS versions
  • Uses App Links for secure URL handling
  • Ensure your SHA-256 fingerprint is registered with BotFather
  • The intent filter with autoVerify="true" enables automatic link verification