Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FirebaseAuth.DefaultInstance.CurrentUser is not updated #444

Closed
QuentinGprd opened this issue Aug 12, 2019 · 3 comments
Closed

FirebaseAuth.DefaultInstance.CurrentUser is not updated #444

QuentinGprd opened this issue Aug 12, 2019 · 3 comments

Comments

@QuentinGprd
Copy link

Hello,

More bugs for Firebase:

Please fill in the following fields:

Unity editor version: 2018.3.14f1
Firebase Unity SDK version: 6.2.2
Firebase plugins in use (Auth, Database, etc.): Auth, Analytics, Database, Crashlytics, Messaging
Platform you are using the Unity editor on (Mac, Windows, or Linux): MacOS Catalina 10.15 beta
Platform you are targeting (iOS, Android, and/or desktop): iOS, Android

Please describe the issue here:

In Unity Editor, when we call ReauthenticateAsync successfully, we are still unable to call UpdateEmailAsync or update any sensitive user information after:

This operation is sensitive and requires recent authentication. Log in again before retrying this
request.

We need to logout and re-signin "manually".

Also, after all update operations, including UpdateUserProfileAsync, we need to logout and signin again to see the changes in FirebaseAuth.DefaultInstance.CurrentUser, even after restarting the Editor.

Not tested on Android or iOS.

Thanks for your support!

@QuentinGprd QuentinGprd added the new New issue. label Aug 12, 2019
@DellaBitta
Copy link
Contributor

Hi @QuentinGprd,

Unfortunately I wasn't able to recreate this issue.

I tested using the auth/test_app as a baseline.  In ReauthenticateAysnc I hard-coded an update to the user profile by updating the display name once the re-authentication completed.

Line 442, immediately after the LogTaskCompletion if {} block, add:

return UpdateUserProfileAsync(newDisplayName: "<something>");

This is successfully updates the profile (immediately after re-authenticating via email) without an error in my testing.

As an additional test, in UpdateUserProfileAsync I chain a task which updates the email address of the account. I then output both auth.CurrentUser and the DefaultInstance.CurrentUser when it completes.  In my tests they were both successfully updated:

Line 303, add:

auth.CurrentUser.UpdateEmailAsync("<some_test_email>")
   .ContinueWithOnMainThread(update_email_task => { 
        EnableUI();
        if (LogTaskCompletion(update_email_task, "User Email")) {
            DisplayDetailedUserInfo(auth.CurrentUser, 1);
            DisplayDetailedUserInfo(Firebase.Auth.FirebaseAuth.DefaultInstance.CurrentUser, 2);
       }
});

Could you update this code to make it fail in the way that you're seeing errors in your app? Thanks!

@DellaBitta DellaBitta added type: question and removed new New issue. labels Aug 14, 2019
@QuentinGprd
Copy link
Author

I just added the following button in the auth/test_app UIHandler:

if (GUILayout.Button("Update DisplayName")) {
            UpdateUserProfileAsync("Kiki");
}

Here is a video of the bug

As you can see, after re-entering Play Mode, the previous name is still displayed. I need to logout then sign in to get the new one.

Let me know if you need anything else.

@stewartmiles
Copy link
Contributor

@firebase firebase locked and limited conversation to collaborators Oct 23, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants