TelegramProvider class

Telegram Login Widget provider.

This is a custom auth provider since Telegram doesn't use standard OAuth. It uses HMAC-SHA-256 verification with the bot token.

Resources

Inheritance
Mixed-in types

Constructors

TelegramProvider({required String botToken, required String botUsername, required String redirectUri, required AuthUser profile(TelegramProfile profile), Duration authDateMaxAge = const Duration(minutes: 5), String successRedirect = '/profile'})
Creates a new TelegramProvider with the given options.

Properties

authDateMaxAge → Duration
Maximum age of auth_date before rejecting.
final
botToken → String
Bot token from @BotFather.
final
botUsername → String
Bot username (without @).
final
hashCode → int
The hash code for this object.
no setterinherited
id → String
Provider identifier used in callback routes.
finalinherited
name → String
Human-readable provider name.
finalinherited
profile → AuthUser Function(TelegramProfile profile)
Maps the Telegram profile to an AuthUser.
final
redirectUri → String
Redirect URI for the callback.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
successRedirect → String
Where to redirect after successful authentication.
final
type → AuthProviderType
Provider category.
finalinherited

Methods

authenticationMethodInventory(AuthStore store) → AuthAuthenticationMethodInventoryContributor?
Builds this provider's authoritative usable-method inventory.
inherited
getAuthorizationUrl() → Uri
Generates the authorization URL (widget page).
handleCallback(AuthContext ctx, Map<String, String> params) → Future<CallbackResult>
Handles the callback from Telegram Login Widget.
override
mapProfile(TelegramProfile telegramProfile) → AuthUser
Maps the verified profile to an AuthUser.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
redacted() → AuthProvider
Creates a provider metadata projection safe for events and audit logs.
inherited
toJson() → Map<String, dynamic>
Summary payload used by /auth/providers.
inherited
toString() → String
A string representation of this object.
inherited
verifyAndParseCallback(Map<String, String> params) → TelegramProfile
Verifies the authentication data from Telegram.

Operators

operator ==(Object other) → bool
The equality operator.
inherited