English
English
Appearance
English
English
Appearance
/public/account/telegram/session/passwordFinish the login of a Telegram account that has Two-Step Verification. Call it after Get Session Telegram reports isPasswordRequired: true, with the password the user types in.
Authorization: Basic Base64(AccessKey:SecretKey))| Field | Type | Required | Description |
|---|---|---|---|
token | string | Yes | Session token returned by Create Session Telegram. |
password | string | Yes | The Two-Step Verification password of the Telegram account. |
curl -X POST "https://api.repliz.com/public/account/telegram/session/password" \
-H "Authorization: Basic $(echo -n 'YOUR_ACCESS_KEY:YOUR_SECRET_KEY' | base64)" \
-H "Content-Type: application/json" \
-d '{"token":"SESSION_TOKEN","password":"USER_PASSWORD"}'import axios from 'axios';
const response = await axios.post(
'https://api.repliz.com/public/account/telegram/session/password',
{
token: 'SESSION_TOKEN',
password: 'USER_PASSWORD',
},
{
auth: {
username: 'YOUR_ACCESS_KEY',
password: 'YOUR_SECRET_KEY',
},
},
);
console.log(response.status);const credentials = btoa('YOUR_ACCESS_KEY:YOUR_SECRET_KEY');
const response = await fetch(
'https://api.repliz.com/public/account/telegram/session/password',
{
method: 'POST',
headers: {
Authorization: `Basic ${credentials}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
token: 'SESSION_TOKEN',
password: 'USER_PASSWORD',
}),
},
);
console.log(response.status);// No content returned on success// Wrong Password
{
"code": 400,
"message": "invalid password"
}
// No Password Asked
{
"code": 400,
"message": "password is not required"
}{
"code": 404,
"message": "session not found"
}{
"code": 401,
"message": "unauthorized"
}204 means Telegram accepted the password. Keep polling Get Session Telegram: isConnected turns true once the login is complete, then call Connect Telegram or Reconnect Telegram.400 invalid password means the password is wrong. The session stays open, so ask the user again and resend it with the same token.400 password is not required means the session isn't waiting for a password: the QR code hasn't been scanned yet, or the account has no Two-Step Verification.404 session not found means the session expired. A session waiting for its password is deleted after about 30 minutes. Create a new session and scan again.Repliz passes the password to Telegram to finish the login and doesn't store it.