celestix / gotgproto

A wrapper for Go Telegram Client, i.e. gotd/td.
GNU General Public License v3.0
162 stars 31 forks source link

Can the session expiration time be set? #65

Open TNT-ma opened 2 months ago

TNT-ma commented 2 months ago

After verifying the authorization, I found that I need to revalidate the code verification permissions the next day

Can the expiration time be set in the files saved during the session? For example, the number of valid days: 30 days or 365 days, permanently valid, etc

celestix commented 2 months ago

You can't set the auth expiration time like this, neither does telegram automatically log-out your account on per day basis like that. I suspect that you're not using persistent session storage for your program.

Check this out for implementing a persistent session store with gotgproto: https://github.com/celestix/gotgproto/blob/d9e8596338d2e2bb5d9ddcaece73d153c89f1218/examples/auth-using-string-session/gotgproto-string/main.go#L32

This will create a my_session.session file which will contain your persistent credentials.