Telegram GramPro icon

Telegram GramPro

Advanced Telegram MTProto client

Actions4

Session Generator → Step:2 Generate String

AI-generated

Summary

Step:2 Generate String generates a pre-auth session string for Telegram authentication using the phone verification code and phone code hash from the Request Code operation. This is the second step in the authentication flow, following Step:1 RequestCode and preceding sign-in. The operation takes the API ID, API Hash, and phone number as required inputs for authentication, and optionally the phone code, phone code hash, and pre-auth session string from the previous step. The resulting session string can be used with the sign-in operation to complete Telegram account authentication.

Inputs

  • apiId (required) — Your Telegram API ID from https://my.telegram.org
  • apiHash (required) — Your Telegram API Hash from https://my.telegram.org
  • phoneNumber (required) — Phone number in international format (e.g., +1234567890)
  • phoneCode (required) — The verification code sent to your phone
  • phoneCodeHash (required) — The phone code hash from the Request Code operation
  • preAuthSession — The temporary session string returned by the Request Code operation
  • password2fa — Optional 2FA password if your account has 2FA enabled

Output shape

string

Returns a pre-auth session string that can be used for Telegram sign-in operations. The session string is typically a base64-encoded buffer containing authentication parameters.

Examples

Example 1: Complete authentication flow

  1. Use Step:1 RequestCode to send verification code and obtain phoneCodeHash and preAuthSession. 2. Use Step:2 Generate String with the phone code and phoneCodeHash to generate session string. 3. Use sign-in operation with the generated session string to complete authentication.

Links

Discussion