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

InvalidOperationException: UPDATE_APP_TO_LOGIN #55

Open
farhad-rad opened this issue Dec 1, 2021 · 18 comments
Open

InvalidOperationException: UPDATE_APP_TO_LOGIN #55

farhad-rad opened this issue Dec 1, 2021 · 18 comments

Comments

@farhad-rad
Copy link

This is the exception thrown when calling SendCodeRequestAsync
It is because Telegram forced all clients to use 64 bit identifier. Yet there is no such good library for c# as TgSharp (TLSharp) is and also unfortunately this library is not useable after this update of telegram. I DO ASK you to provide 64 bit identifiers for this powerful library. thank you.
Here is the stack trace:

TLSharp.Core.Network.MtProtoSender.processMessage(ulong messageId, int sequence, BinaryReader messageReader, TLMethod request, CancellationToken token)
TLSharp.Core.Network.MtProtoSender.Receive(TLMethod request, CancellationToken token)
TLSharp.Core.TelegramClient.RequestWithDcMigration(TLMethod request, CancellationToken token)
TLSharp.Core.TelegramClient.SendCodeRequestAsync(string phoneNumber, CancellationToken token)
Ako.Sbmu.Core.Telegram.SendCodeAsync() in Telegram.cs
 _authHash = await Client.SendCodeRequestAsync(_phoneNumber);
@jamesjsc
Copy link

jamesjsc commented Dec 2, 2021

Telegram updated:
Support for int64 IDs
With its rapid growth, Telegram is moving from 32-bit to 64-bit IDs so that users can continue creating billions of groups, channels and bots. Your app will need to support these new IDs as soon as possible to ensure users aren't interrupted.
To do so, make sure your app supports this API layer: https://core.telegram.org/api/layers#layer-133

TgSharp only support layer - 108.

@jamesjsc
Copy link

jamesjsc commented Dec 2, 2021

We need to update TgSharp layer-133

@AllowCode
Copy link

Dear author of the library, should you expect a solution or decide for yourself? thanks

@PhilAsCoder
Copy link

Hi guys,
Ive managed to get the new TL definitions using the json and the TLgenerator.

This caused some trouble with missing references and unreqocnized objects but i just outcommented those.
Next i did alter the layer version in the telegramclient and i did change the MakeAuthAsync function to return the user which went also wrong.

In my project (which references these files) i needed to change several things too. Mainly the channel ID props as well as replyToId which is changed a bit.

Should you want to check and try this, this is the zipfile containing the files.

This seems to work for us.

Hope this get you guys started.

TgSharp.Core.zip
TgSharp.TL.zip

@AllowCode
Copy link

@PhilAsCoder
Hello Friend. I compiled both projects, each project compiles 2 files, which one should I select? When replacing the original files with these files, an error appeared "method not found"

@PhilAsCoder
Copy link

Hi,

The TgSharp.TL builds the TL dll while the TgSharp.Core builds both since the Core depends upon the TL.
When i compile it no error is generated.

Perhaps you have used some function(s) in the old build which are no longer supported?
For me this rebuild with layer 133 works but i might not use the specific function you seem to miss?

@AllowCode
Copy link

AllowCode commented Dec 2, 2021

@PhilAsCoder
I have no compilation errors, had errors with old functions work after replacing the original files. The functions there were written for the tlsharp version, perhaps this is the case. I'll try to use the library in a new project, thanks

@farhad-rad
Copy link
Author

@PhilAsCoder How did you calculate constructor number for some classes which inherits TLObject ??
I need the way you calculate them to fulfill some other classes as well.

@PhilAsCoder
Copy link

@PhilAsCoder I have no compilation errors, had errors with old functions work after replacing the original files. The functions there were written for the tlsharp version, perhaps this is the case. I'll try to use the library in a new project, thanks

No i used the original TGsharp library which was presented here at the beginning and just updated the TL layer (which TgSharp uses) so no methods were missing in my case

@PhilAsCoder
Copy link

@PhilAsCoder How did you calculate constructor number for some classes which inherits TLObject ?? I need the way you calculate them to fulfill some other classes as well.

I didnt, all i did was use the TLGenerator exe which is inside the project, downloaded the latest Telegram Json file and then it outputted the TL objects.
I didnt need to 'calculate constructors'. I only outcommented several properties in order for me to compile it. Some properties like 'invites' etc

@AllowCode
Copy link

@PhilAsCoder, not work for me, but ty

@vuminhit
Copy link

vuminhit commented Dec 3, 2021

@PhilAsCoder Where I can find TLgenerator?
Thanks!

@PhilAsCoder
Copy link

@vuminhit its under the TgSharp project
https://github.com/nblockchain/TgSharp/tree/master/src/TgSharp.Generator

@PhilAsCoder
Copy link

PhilAsCoder commented Dec 7, 2021

Hello @jamesjsc ,

Yes for us it solved the issue posted here at the top of the page by the OP.
All i did was re-genarate the TL files by using the TLGenerator and the latest Telegram Json file. Then outcommented several properties (like invites we dont use those) and related calls and rebuilded the dlls.
After that of course i needed to tweak our project a bit to support the new Telegramclient calls which were slightly different as well as, from memory (not at the computer), change some ReplyTo calls because those were now in its own object.

So yes, this issue was solved by using this approach using the dlls I did post above.

Take care

@archnguyen27
Copy link

Hello @PhilAsCoder,
Sorry with my bad English :(
Is your TGSharp updated with newest Telegram API updates? Thanks.

@PhilAsCoder
Copy link

Hello @archnguyen27 ,

Yes the TL code i posted in the zip was generated by using the latest Telegram json file, so its based on version 133 from memory.

@imamazhar208
Copy link

Hi guys, Ive managed to get the new TL definitions using the json and the TLgenerator.

This caused some trouble with missing references and unreqocnized objects but i just outcommented those. Next i did alter the layer version in the telegramclient and i did change the MakeAuthAsync function to return the user which went also wrong.

In my project (which references these files) i needed to change several things too. Mainly the channel ID props as well as replyToId which is changed a bit.

Should you want to check and try this, this is the zipfile containing the files.

This seems to work for us.

Hope this get you guys started.

TgSharp.Core.zip TgSharp.TL.zip

hi I'm using this Lib but I'm getting the error "Flood prevention. Telegram now requires your program to make a request again only after 49649 seconds have elapsed (TimeToWait property). If you think the cause of this issue might lie in the TgSharp implementation, please go to Github issues. "

when registering a new phone number, other functions work normally, but registration function does not work, do you know how to avoid this error? can i contact you on telegram?

@archnguyen27
Copy link

@PhilAsCoder Thanks you so much. You save me :D

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

7 participants