Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while login to Telegram test servers (PHONE_CODE_INVALID) #734

Open
stanislavzhe opened this issue Oct 14, 2024 · 0 comments
Open

Comments

@stanislavzhe
Copy link

stanislavzhe commented Oct 14, 2024

Got an error "Error in authTestUser: For +9996611502. RPCError: 400: PHONE_CODE_INVALID (caused by auth.SignIn)" when trying to login to telegram test server
For +9996611502 was using code 11111

async authTestUser(phoneNumber: string, code: number, user = "User One") {
        let stringSession = new StringSession("");
        let telegramTestDC = {
            dcId: 3,
            ip: "149.154.175.117",
            // dcId: 2,
            // ip: "149.154.167.40",
            // dcId: 1,
            // ip: "149.154.175.10",
            port: 443,
        }
        stringSession.setDC(
            telegramTestDC.dcId,
            telegramTestDC.ip,
            telegramTestDC.port
        );
        this.client = new TelegramClient(stringSession, apiId, apiHash, {
            testServers: true,
            connectionRetries: 5,
            requestRetries: 10,
        });
        await this.client.start({
            phoneNumber: phoneNumber,
            phoneCode: async () => { return code.toString() },
            firstAndLastNames: async () => { return [`First name ${user}`, `Last name ${user}`] },
            onError: (err: any) => {
                throw new Error(`Error in authTestUser: For ${phoneNumber}. ${err}`);
            },
        });
        this.clientSessionString = await this.client.session.save();
        console.log(this.clientSessionString);
        return this.client;
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant