gotd / td

Telegram client, in Go. (MTProto API)
MIT License
1.49k stars 134 forks source link

client: PhoneCode missing in AuthSignUpRequest #747

Closed Xniveres closed 2 years ago

Xniveres commented 2 years ago

AuthSignUpRequest is missing "PhoneCode", the official telegram docs are wrong on this as well:

https://core.telegram.org/method/auth.signUp

current struct:

type AuthSignUpRequest struct {
    // Phone number in the international format
    PhoneNumber string
    // SMS-message ID
    PhoneCodeHash string
    // New user first name
    FirstName string
    // New user last name
    LastName string
}

should be:

type AuthSignUpRequest struct {
    // Phone number in the international format
    PhoneNumber string
    // SMS-message ID
    PhoneCodeHash string
        ///Auth Code
    PhoneCode string
    // New user first name
    FirstName string
    // New user last name
    LastName string
}

https://core.telegram.org/method/auth.signUp

at the parameter list are 4 parameters, in the example 5.

tdakkota commented 2 years ago

Why do you think that PhoneCode field is missing? There is no such field in TDLib schema.

ernado commented 2 years ago
auth.signUp#80eee427 phone_number:string phone_code_hash:string first_name:string last_name:string = auth.Authorization;

Probably the example is wrong or outdated, auth.signUp has 4 fields in all known schemas.

Xniveres commented 2 years ago

Why are you think that PhoneCode field is missing? There is no such field in TDLib schema.

look at the error codes from https://core.telegram.org/method/auth.signUp PHONE_CODE_EMPTY | phone_code is missing.

you can also validate this issue if you run it in the test network.

tdakkota commented 2 years ago

look at the error codes from https://core.telegram.org/method/auth.signUp PHONE_CODE_EMPTY | phone_code is missing.

It does not mean anything. Official Telegram docs is often to be outdated or even wrong.

you can also validate this issue if you run it in the test network.

I've checked it and everything works fine.

ernado commented 2 years ago

@tdakkota AFAIK we have e2e test that uses test server + code auth, but I'm not sure whether it is enabled or not.

Can you please check?

tdakkota commented 2 years ago

but I'm not sure whether it is enabled or not

It isn't. Issue #554.

ernado commented 2 years ago

Pyrogram: https://docs.pyrogram.org/telegram/functions/auth/sign-up#pyrogram.raw.functions.auth.SignUp (4 fields) Telethon: https://tl.telethon.dev/methods/auth/sign_up.html (4 fields) Grammers: https://github.com/Lonami/grammers/blob/a0953b22508c97b25ea8c266ba867daf456fef8d/lib/grammers-client/src/client/auth.rs#L464-L478 (4 fields) Madeline: https://docs.madelineproto.xyz/API_docs/methods/auth.signUp.html (4 fields)