• 8
name

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191

Backtrace:

File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

If users switch their phone from ios to android and vice versa they can't log in to my app using their email and password.

There is no option to log in with FB or any social media account.

Could you please tell me how to allow users to login into both devices into the same app?

Also what happens if the user is still logged in into the iOS app but wants to use the app on Android?

Thank you

    • You seem to have answered your own question if you provide an option to log in with FB or any social media account.
    • Maybe some server side error or something! Not sure as you have not specified any error which you are facing
      • 1
    • You need to clearly define what your business requirements are. Do you want to prevent a user from logging in to two different devices at the same time? How are you authenticating users? Do you have an API that you call to do this? If you want to track who is actively logged in, what about instances where the app crashes and they don't log out? Does the authentication time out after so many minutes? You need to think this through before we can give accurate advise.

You need some kind of backend server. It remains same for iOS and android. usually you will make an async request to server, with username and password, and server will reply if user is authenticated or not. (server will check username and password and reply with true or false). This mechanism applies to iOS as well as android.

You can use

  1. Firebase Authentication Check Here
  2. Custom Backend Server(using PHP or Node etc)
  3. There are so many other options to choose from for your backend

Regarding your question

Also what happens if the user is still logged in into the iOS app but wants to use the app on Android?

You should allow user to be logged Into ONE device AT A time. For this, there is a concept of Session Management.

When you send a request to your backend server. It can generate an auth token. Then you will need to send auth token with each API request.

Now imagine user logged into your app on android. server generated a token and sent it back to android. Android app saved the token. Now when user logs into iOS, a new token will be generated. previous token will be invalidated and when android app sends a request with expired token, server will not send response.

See this answer for a general concept of session management.

Hope it helps. Let me know if you need further clarifications

Now

  • 1
Reply Report

Well in your case its not fault of frontend developers.

You are or your backend developer only in need to enable multisession work on your backend.

You are not required to do any work in actually But your backend developer is in need to do so. the backend developer needs to maintain multiple login session for a single account, just ask backend developer to do so.

  • 0
Reply Report