-
Type: Bug
-
Resolution: Declined
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Labels:None
Problem Statement/Rationale
I have two users-id and I am testing the log-out and log-in as different users (from my html5 application) to make sure my app works correctly. Most of the time it is working fine but randomly it logs in as the previously logged-in user.
Steps to Reproduce
Create a html5/JS application and implement the code to login (code given below) to Realm app.
- User A logs in
- User A logs out
- User B Logs in. In Realm logs, I can see User B successfully authenticated
- After successful login, my app invokes Realm functions to get the data. At this point, it is getting the data of User A.
- I noticed that right after app.login is called, the variable app.currentUser is showing the _id of user B correctly but the email address is of user A instead of the current user which is user B. More specifically app.currentUser.profile.email gives the email of User A instead of user B. Note that this happens only randomly.
var user = app.logIn(credentials).then(function (oResponse)
{ window.console.log(app.currentUser); this.setCurrentLoggedInUser(app.currentUser); //Here currentUser has the details of User A while User B is the one who just tried to login successfully. Also user.id is giving 'undefined' this.setAppObject(app); // `App.currentUser` updates to match the logged in user window.console.log("fn fetchUser: resolving"); fnResolve(oResponse); }.bind(this)).catch(function (oError)
{ window.console.log("fn fetchUser: rejecting"); window.console.log(oError); // fnReject(oError.errorCode); fnReject(oError); }.bind(this));
Expected Results
Each time a user logs-in via app.login, the return value (currentUser) should have the email address of the current logged-in user ..just like how it gives the _id.
Actual Results
Instead, the profile.email is giving the email address of previous logged-in user.
Additional Notes
See attached screenshots