onnela-lab / beiwe-android

Beiwe is a smartphone-based digital phenotyping research platform. This is the Beiwe Android app code. The Beiwe2 app is also available on the Google Play store to use with open source builds of the Beiwe backend.
https://www.beiwe.org/
BSD 3-Clause "New" or "Revised" License
26 stars 16 forks source link

Study registration not working #63

Closed amgeronimo closed 9 months ago

amgeronimo commented 1 year ago

Tried registering a android phone (android version 9) with a new instance of the beiwe2 app. Cannot advance past the registration screen. Gives the error "Are you sure the URL for the study is correct? Beiwe cant connect to the server" on the phone. However, the backend shows than an android phone has registered. The phone cannot advance past the registration screen.

biblicabeebli commented 1 year ago

Looking into it, apologies for the inconvenience - in the meantime check if easy-enrollment (can be enabled on a per-participant or per-study basis in their respective pages) allows registration to work.

Please make sure your Beiwe servers are up to date, I do my best with backwards compatibility but maybe something squeaked by.

(There wasn't any intentional change to registration logic on the 3.4.x update, that error message is fairly specific and relates to network problems so hopefully I can track this down pretty quick.)

biblicabeebli commented 1 year ago

Ah, I have worked out the issue. The error message displayed is incorrect. When you provide a value for the temporary password that does not match the current password on the server it incorrectly displays the bad URL message. When you get the value correct registration proceeds as expected.

The registration process could be generally better, we made easy enrollment mode (which disables the temporary code validation at registration entirely) to help streamline enrollment. (Thank you for posting, this explains some glitches we've not been able to explain, and the second enrollment attempt would always work so the issue was never raised back up to me.)

I'll try and fix this - it is probably a backend return-the-correct-error-code issue rather than an app issue, the backend received updates to the registration process a couple months ago. (possibly the addition of easy enrollment, heheh, oops.)

We are planning to clean up enrollment, ideally have a QR code mode, at the very least add a validation field or make the temporary key visible, and get a better way of authenticating the app to the server as there are some desync bugs; make login use any present harware authentication options with an optional pin for both the android and ios apps... but that's not started yet and affects 3 codebases so don't make any plans that depend on it.

biblicabeebli commented 1 year ago

Actually it looks like the error message is correct with the current state of the backend code, there was a change in the truly distant when-iOS-was-first-built past to the way errors were detected at registration time, the error message reads: Sorry: either your Study URL, your User ID, or your Temporary Password is incorrect.

When the app can't reach the server at all it displays: Are you sure the URL for the study is correct? Beiwe can't connect to the server.

amgeronimo commented 1 year ago

Yes, i can confirm that when registering a new android user I get the second error code. On the server, the user appears to be registered. Identifier files are listed on the dashboard. When i press the registration button again on the app, i get the first error code. I assume this is because the server has now accepted the new password, and the temporary password is no longer valid.

I will update the beiwe server on my end.

biblicabeebli commented 1 year ago

(woops double reopened?)

Reopenning issue, I will continue to look into this, I did not replicate that half.

biblicabeebli commented 1 year ago

ok, I think we finally had this happen on our server - not positive, but there is a bug with intervention dates.

biblicabeebli commented 1 year ago

bug report (internal link just stashing this on the direct issue): https://onnela-lab.sentry.io/issues/4183280305/?alert_rule_id=213882&alert_timestamp=1684079431465&alert_type=email&project=133863

Walp, that's a dead link.

biblicabeebli commented 1 year ago

Well I've fixed the bug we had (its not on the main branch yet), but still need to check some things.

biblicabeebli commented 1 year ago

Hm, the failed registration that produced the bug I saw does not have the falsely registered situation you encountered, it was a different bug.

biblicabeebli commented 9 months ago

I have been unable to replicate this bug, Android code has had substantial churn since original post, I'm going to close this issue. If you have a configuration that results in this bug on updated Android and Backend code please let me know.