gotgproto
gotgproto copied to clipboard
QUESTION: Session problems
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
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 :)
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
What do you mean? Please rephrase your question.
Yeah, you need to use your exported string session as an argument to StringSession function
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)
and the echo function does not work so the client is not properly set up yet, when using the string session
That's strange :thinking: I will check and get back to you.
Thank you very much, keep me updated once you check )
Any updates?
Any updates?
Please be patient. I am trying to arrange a telegram account for testing it.
Just a quick follow up does the string session work?
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?