Having to click log in button twice to access CurrentUser()

We are calling asynchronous login for a registered user on a button click. The first time we click it, the log says “success” but isValidLogin returns false and currentUser is null. If we press the same button again, then we get “success” in the log again, and isValidLogin returns true and prints CurrentUser.getEmail to the emulator screen. So we essentially have to click the button twice to log in.

Hi, Matthew!

If you use async login method, you should check for isValidLogin and CurrentUser inside the handleResponse method. If you check isValidLogin outside the handleResponse (as shown on you screenshot) you’ll get isValidLogin = false since the login was not yet completed.