xtrime-ru / TelegramApiServer

Fast, simple, async php telegram api server: MadelineProto + Amp HTTP Server
https://tg.i-c-a.su
MIT License
562 stars 124 forks source link

Received verification code #99

Closed jaynlive closed 1 year ago

jaynlive commented 2 years ago

i call "/api/users/jason/phoneLogin?phone=a new phone",it return true,but not received verification code.

this is it return

{
    "success": true,
    "errors": [],
    "response": {
        "_": "auth.sentCode",
        "flags": 0,
        "type": {
            "_": "auth.sentCodeTypeSms",
            "length": 5
        },
        "phone_code_hash": "e30887c4ae9ef3e9c5",
        "phone_number": " 8613521354289"
    }
}

the phone haven't registered an account yet.

After manual registration, the verification code is still not received in the request again

xtrime-ru commented 2 years ago

Are you sure phone is correct? Try interational format and escape special symbols. + will be %2B in urlencode

jaynlive commented 2 years ago

Are you sure phone is correct? Try interational format and escape special symbols. + will be %2B in urlencode

thank you. i received code after phone add %2B. return this

{
    "success": true,
    "errors": [],
    "response": {
        "_": "auth.sentCode",
        "flags": 2,
        "type": {
            "_": "auth.sentCodeTypeApp",
            "length": 5
        },
        "phone_code_hash": "6afd5b1a587e4398fc",
        "next_type": {
            "_": "auth.codeTypeSms"
        },
        "phone_number": "+8613521354289"
    }
}

the type is 'auth.sentCodeTypeApp', and have the 'nexttype':{"": "auth.codeTypeSms"}. it work well. this phone is already register and login in telegram app.so send a code to telegram app.

but when I change an unregistered mobile phone number. it return true ,but not received in sms. this is return

{
    "success": true,
    "errors": [],
    "response": {
        "_": "auth.sentCode",
        "flags": 0,
        "type": {
            "_": "auth.sentCodeTypeSms",
            "length": 5
        },
        "phone_code_hash": "0274d8f71d94d78614",
        "phone_number": "+8613521166345"
    }
}

the type is 'auth.sentCodeTypeSms'. and have not 'next_type'. also , I didn't receive the verification code via SMS. Do I need to register manually before use api to login in?

xtrime-ru commented 2 years ago

Do I need to register manually before use api to login in?

Yes. Telegram can have some restrictions for unofficial apps. You can try web.telegram.org (its opensource and unofficial too). Its better to register in official mobile app.