gotgproto icon indicating copy to clipboard operation
gotgproto copied to clipboard

QUESTION: Session problems

Open l1ah1m opened this issue 10 months ago • 12 comments

Screenshot 2024-04-27 at 19 46 17

Even when i pass in a string of a session it still tries to send a code and get a code from me. Additionally it creates the session storage files. you see i need to store the session in the mongodb and how do i properly extract it so that when i create a new client next time the server restarts it wont ask me the code that comes to telegram.

P.S i extract the session with client.ExportStringSession() maybe there is a better way

l1ah1m avatar Apr 27 '24 14:04 l1ah1m

Screenshot 2024-04-27 at 19 46 17 Even when i pass in a string of a session it still tries to send a code and get a code from me. Additionally it creates the session storage files. you see i need to store the session in the mongodb and how do i properly extract it so that when i create a new client next time the server restarts it wont ask me the code that comes to telegram.

P.S i extract the session with client.ExportStringSession() maybe there is a better way

GoTGProto currently doesn't support storing session in MongoDB, but you can add it yourself if you want. Look as https://github.com/celestix/gotgproto/blob/beta/sessionMaker/sessionConstructor.go

You can even make a PR to contribute it for everyone :)

celestix avatar Apr 27 '24 15:04 celestix

The question is why can i use the string session extracted by client.ExportStringSession() in the format like here Session: sessionMaker.StringSession() and just save the string however i want

l1ah1m avatar Apr 28 '24 09:04 l1ah1m

What do you mean? Please rephrase your question.

celestix avatar Apr 28 '24 10:04 celestix

Screenshot 2024-04-28 at 15 16 06 explained everything here

l1ah1m avatar Apr 28 '24 10:04 l1ah1m

Yeah, you need to use your exported string session as an argument to StringSession function

celestix avatar Apr 28 '24 12:04 celestix

Screenshot 2024-04-29 at 00 36 35

but even when i pass in the exported string session it is still asking me the code as below(the session is fake in the example)

Screenshot 2024-04-29 at 00 30 04

and the echo function does not work so the client is not properly set up yet, when using the string session

Screenshot 2024-04-29 at 00 30 16

l1ah1m avatar Apr 28 '24 19:04 l1ah1m

That's strange :thinking: I will check and get back to you.

celestix avatar Apr 28 '24 20:04 celestix

Thank you very much, keep me updated once you check )

l1ah1m avatar Apr 29 '24 03:04 l1ah1m

Any updates?

l1ah1m avatar Apr 29 '24 10:04 l1ah1m

Any updates?

Please be patient. I am trying to arrange a telegram account for testing it.

celestix avatar Apr 29 '24 13:04 celestix

Just a quick follow up does the string session work?

l1ah1m avatar Apr 30 '24 16:04 l1ah1m

Just a quick follow up does the string session work?

Hi @XT3RM1NATOR, I tried exporting a string session and using it to start the client and it worked completely fine. I think you're doing something wrong at your end, can you show the code you're using to do it?

celestix avatar Apr 30 '24 21:04 celestix