BIDMCDigitalPsychiatry / LAMP-platform

The LAMP Platform (issues and documentation).
https://docs.lamp.digital/
Other
12 stars 10 forks source link

Repeated Logout from Mindlamp 2 #639

Closed ertjlane closed 2 years ago

ertjlane commented 2 years ago

Describe the bug App logs out intermittently, usually after several hours. The app would then log back in on its own. Was replicated across multiple phones. Backend examination of lamp activity for one of the phones gave timestamps of logout instances (screenshots below).

To Reproduce Steps to reproduce the behavior:

  1. Open mindlamp after login.
  2. See error

Expected behavior Click on app from home screen, app opens to logged in user on the 'assess' page.

Screenshots Image Image (1) issue

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context *Appeared on 2 phones of same model and OS.

ZCOEngineer commented 2 years ago

We are checking this, shall update our findings/questions soon

jijopulikkottil commented 2 years ago

Hope you are getting issue when using other than the production domain (api.lamp.digital).

Could you give us the domain name and test username/password to test?

jtorous commented 2 years ago

It is not our BIDMC/Boston one, but instead: mindlamp-api-dev.pronet.med.yale.edu My test account that had a logout in the issue is:

Email: @.*** Password: 45yQVEEu!wsp

jijopulikkottil commented 2 years ago

Could you send the email (username) to @michaelmenon 's email

jtorous commented 2 years ago

Yes, just did!

divyav2020 commented 2 years ago

We have kept the phone with the user logged in status to see if the logout issue can be reproduced, so far we have not experienced any issues, we are watching it over the weekend, shall update here as soon as we find anything

jtorous commented 2 years ago

Thanks - it seemed to happen with notifications for activities once. But I understand it may be hard to catch.

jijopulikkottil commented 2 years ago

it seemed to happen with notifications for activities once

Just to confirm that.. Are you using the above given researcher account and experience the logout issue with the same account? Or getting logout issue with any participant account under this researcher ? [because researcher has no notifications]

jijopulikkottil commented 2 years ago

Tested on iOS, When login with given credentials (researcher account) on mindlamp-api-dev.pronet.med.yale.edu, it doesn't return authorization token and identity object from web page to native.

As the basic auth details are not available in the app, it will navigate to login page on next launch. This is happening now.

We can investigate this with @Linoy339. @avaidyam

jijopulikkottil commented 2 years ago

But When we login using a participant (e@.com), on same domain mindlamp-api-dev.pronet.med.yale.edu, it does return authorisation token and identity object correctly. So no issues with this participant login.

sarithapillai8 commented 2 years ago

@avaidyam @jtorous

The logout issue we are experiencing is with researcher account, not with participant account. We tried with different accounts and same issue experiencing in both Android and iOS apps. After debugging the issue, we are not sure about the actual cause of the issue. The only issue we can see is the dispatch event is not getting triggered for researcher account, but working with participant account. But there is no condition for researcher/participant login there. There is no exception, and when we console the objects, we are getting correct values.

This is line where the login dispatch event is fired : https://github.com/BIDMCDigitalPsychiatry/LAMP-js/blob/master/src/index.ts#L185

And the dispatch event is triggered for logout event. https://github.com/BIDMCDigitalPsychiatry/LAMP-js/blob/master/src/index.ts#L191

@avaidyam do you have any suggestion for this issue as this was actually not implemented by us.

//cc @ZCOEngineer @michaelmenon

avaidyam commented 2 years ago

@sarithapillai8 We suspect the issue is linked to push notification delivery (as mentioned before) and seems to only happen on iOS. @jijopulikkottil This sounds like the WKWebView issue we discussed previously. Can you double check on that?

jijopulikkottil commented 2 years ago

@avaidyam It doesn't seems to be any connection with Push notification. On native side, we are facing the issue that, app doesn't receive login message (login message with authentication details) when a researcher logged in. As the authentication token is not received, app will prompt login again when relaunch app

avaidyam commented 2 years ago

I think you may be misunderstanding the issue we are trying to solve. When a patient is logged in, at some arbitrary point thereafter they reopen the app to find they are now "logged out", and then a few hours later they open the app again to find that they are "logged back in". It's not related at all to researcher login.

jijopulikkottil commented 2 years ago

@avaidyam Thanks to the clarification of issue

jijopulikkottil commented 2 years ago

Hope this issue is experiencing only in iOS device. @avaidyam So this could be the problem. We are also keeping the token in UserDefaults.

But as per the first this comment, it received 'logout' event, this is not expected with this(UserDefault-lock) case.

avaidyam commented 2 years ago

@jijopulikkottil The fix for the suspected issue was already merged into master. Can you please pull from master and test the iOS build with the staging dashboard?

michaelmenon commented 2 years ago

Hi @avaidyam can you please let us know what was the issue and the fix made, so that we test the correct scenario.

michaelmenon commented 2 years ago

Hi @avaidyam hope these were the fixes you were talking about.

This seems to be fixing the researcher logout issue which we thought initially the main issue was :

https://github.com/BIDMCDigitalPsychiatry/LAMP-dashboard/pull/622/commits/d3ed07ff2e1a01d5a1401f8d7f98c865fab79ed9

Also there seems to be one update on the iOS side : https://github.com/BIDMCDigitalPsychiatry/LAMP-core-ios/pull/47

Not sure if this has resolved the suspected issue of participant logout as that is not always reproducible. Team was testing today and we can share our updates Monday in our call.

ZCOEngineer commented 2 years ago

With the new iOS build too we are not getting this issue.

Devayani0102 commented 2 years ago

Two users reported being logged out repeatedly.

User U5209744141 on iPhone 7 or 8 is getting logged out continuously and has to log-in every time. [June 30, 2022] User U1456972679 on iPhone XR gets logged out occasionally (especially when they click on the notifications instead of the app icon) [since May 25, 2022]

jijopulikkottil commented 2 years ago

Hi @Devayani0102 Could you confirm the app version using. AppStore app or Test flight app ? The above fix is not yet available on appstore app.

When you see the login screen when reopening the app, could you force quit the app and relaunch and check wether it is loading home page or login page ?

ZCOEngineer commented 2 years ago

@Devayani0102 were you able to check this?

avaidyam commented 2 years ago

@jijopulikkottil I had @ertjlane check this, and it seems like the TestFlight build didn't get pushed to production yet. I'll take care of that right now. Do you know if we can make this process automatic in the CI/CD (i.e. submit to app store for production) for when we create a GitHub Release?

jijopulikkottil commented 2 years ago

Yes @avaidyam . We have done this. If we push/merge to master, then it will make a staging pointed build. And if we create a release, it will be production pointed.

avaidyam commented 2 years ago

@jijopulikkottil Yes, but does it automatically create a release and submit the build for app store review?

jijopulikkottil commented 2 years ago

No. You mean create new version, add 'Whats New' etc.. and submit for review. right ? So are we supposed to integrate fastlane deliver ?

avaidyam commented 2 years ago

@jijopulikkottil Is there a way to do that without using fastlane? I believe firebase has an equivalent feature but I'd prefer using the first-party Apple app store connect CLI tools or API.

jijopulikkottil commented 2 years ago

Here is the official doc. [Those are API calls] It seems to be they deprecated 'App store version submission apis'. And not mentioned what are the api to use instead.

Tuna9129 commented 1 year ago

This seems to be fixed in staging!

ertjlane commented 4 months ago

I'm making a quick note here. Another user has reported this issue, specifically with a

ZCOEngineer commented 4 months ago

@ertjlane lets first try to reproduce this here in the same os version.

jijopulikkottil commented 4 months ago

@ertjlane Thanks for posting the issue here rather than create new one. Hope the issue is same https://github.com/BIDMCDigitalPsychiatry/LAMP-platform/issues/639#issuecomment-1139897285

Also could the user confirm the below scenario ? When you see the login screen when reopening the app, could you force quit the app and relaunch and check wether it is loading home page or login page ?

ertjlane commented 4 months ago

@jijopulikkottil Thanks. It is actually distinct from the comment you linked, in that the user stays logged out, and must login again manually. Like the original issue, however, it is disconnected from the researcher login. I will reach out and inquire if the user would implement the strategy you mentioned.