Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Call for Presentations - Qt World Summit

    Unsolved How to make session system in mobile application

    Mobile and Embedded
    5
    9
    990
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      maydin last edited by

      In frameworks like Flask or NodeJS, there are session modules that help us implementing login system. But those applications run through internet browsers generally.

      I want to make a mobile application with login system. I can write online API with Flask or NodeJS but I dont know how I handle phone application.

      I will make a login dialog but what should happen after user enters their credetials. I will send username and password to API but what should return and what i should do with that.

      jsulm 1 Reply Last reply Reply Quote 0
      • jsulm
        jsulm Lifetime Qt Champion @maydin last edited by

        @maydin Where do you want to log in? In your app on the phone or on some server?

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        M 1 Reply Last reply Reply Quote 0
        • 6thC
          6thC last edited by

          What you've mentioned are more frameworks and not a specific authentication protocol or anything like that... not sure the real answer you want cause I can't really make out a clear question. However, here's my response, I hope it helps:

          Authenticating with a server shouldn't matter mobile or app really - assuming they are a network packet with data / web requests to a server right?

          There's network authentication docu at: https://doc.qt.io/qt-5.11/qtnetworkauth-index.html

          There are also example apps (which are often a great way to fill in any gaps) at: http://doc.qt.io/qt-5/examples-network.html

          1 Reply Last reply Reply Quote 0
          • M
            maydin @jsulm last edited by

            @jsulm I want to make an application like Twitter or Facebook. In those applications, after logging in you will see your feed etc. But if you change your password from different place, it automatically logs out from mobile app.

            @6thC I already checked those examples and modules. OAuth is different thing probably according to my research. If my app wants to use some data from Facebook, it should connect to OAuth system of Facebook. But I dont want to connect external APIs like Facebook or Twitter.

            Let me give me an example:

            • User opens app and sees login dialog.
            • User enters their name and password.
            • Then app shows user's feed, events etc.
            • Everytime user open app again, it automatically logs on (in web browsers, cookies helps for this)
            1 Reply Last reply Reply Quote 0
            • SGaist
              SGaist Lifetime Qt Champion last edited by

              Hi,

              You should check the Cutelyst project which might simplify your application/web backend development.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply Reply Quote 0
              • M
                maydin last edited by

                I think I cannot explain what I want.

                I know how to write programs in Qt and i can write web server by using NodeJS.

                I just want to make a "login" system. User will enter his name and password and he will see the things in program.

                I will send username and password to my webserver and what will happen. This is problem. What should i do next?

                kshegunov 1 Reply Last reply Reply Quote 0
                • kshegunov
                  kshegunov Moderators @maydin last edited by

                  @maydin said in How to make session system in mobile application:

                  What should i do next?

                  Well the server should return you something - a login success/failed with optionally a status message, maybe also some kind of credentials tree/list. You can just store the response data in your own class and continue on from there. Whenever you have something that requires a logged user, you check if they've logged in and if they have access to that feature ... pretty much the same thing you do with web development.

                  If your auth scheme (which is not clear from the question) is more complicated, it may be needed to exchange tokens between the client and the server at key points, however this really depends on how you mean to implement the application.

                  Read and abide by the Qt Code of Conduct

                  M 1 Reply Last reply Reply Quote 2
                  • M
                    maydin @kshegunov last edited by

                    @kshegunov Yes, you told what I want to hear.

                    It seems I have to store username and password in my application and send to server anytime I want to request something along with data. An example request should look like this:

                    {
                      id: 1 ,
                      credentials: {
                        username: user123
                        password: pass123
                      },
                      request: "showFeed"
                    }
                    

                    If your auth scheme (which is not clear from the question) is more complicated, it may be needed to exchange tokens between the client and the server at key points, however this really depends on how you mean to implement the application.

                    Webserver frameworks like Flask and NodeJS provide modules for auth. Probably I should learn those modules' token system and design app according to that.

                    If you have any advice for designing app with auth system (also for webserver), I would like to hear.

                    kshegunov 1 Reply Last reply Reply Quote 0
                    • kshegunov
                      kshegunov Moderators @maydin last edited by

                      @maydin said in How to make session system in mobile application:

                      Probably I should learn those modules' token system and design app according to that.

                      Indeed, perhaps is a good idea to at least glance at them and try to see what the idea is, then decide what to do with your app.

                      If you have any advice for designing app with auth system (also for webserver), I would like to hear.

                      Not really, this is very specific to the way the app is going to work and what you mean by auth, whether it includes only users and passwords, does it have user roles and/or specific permissions for specific actions; whether the permissions are "flat" or form a tree of choices and so on.

                      Read and abide by the Qt Code of Conduct

                      1 Reply Last reply Reply Quote 0
                      • First post
                        Last post