Giter Club home page Giter Club logo

flutter_libtdjson's Issues

Save authentication state in SharedPreferences to avoid constantly logging in

Hello,

Nice dart implementation of TDLib, it's a pain to use without it. I have a question though, where is the authentication key stored when performing the auth flow for telegram using this library ?

I want to store the auth token locally so that I can use https://core.telegram.org/method/auth.importAuthorization to not have to do the auth login flow every time I open my app after closing it.

If that is handled automatically (i.e. the tdlib service saves its state locally and the user is never logged out unless an @type: logOut request is sent), is there a way to simply detect whether the user is currently logged in ?

Thanks,

receive and authorizationStateClosed

await Future.delayed(Duration(seconds: timeout.round()));

change, better here:
sendPortToMain.send(s);

json.decode and send map
and check authorizationStateClosed

Example:

String? s = _rawClient.td_json_client_receive(clientId, timeout);
      if (s != null) {
        Map<String, dynamic> j = json.decode(s);
        sendPortToMain.send(j);
        if (j['@type'] == 'updateAuthorizationState') {
          if (j['authorization_state']['@type'] == 'authorizationStateClosed') {
            break;
          }
        }
      }

How to get user id after login?

Hi, I just read your example code and I'm wondering that what I should do to get the user id after successfully logged in (after checkAuthenticationCode)? I want to get the user info through the user id. Actually, I can see some logs about the user info in the debug console, but I don't know how to get it. Any answer will be appreciated, thanks!

Btw, nice package!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.