Skip to content

[CRASH + DISCUSSION] Should we request Twitter email transparently? #436

Closed
@SUPERCILEX

Description

@SUPERCILEX

While working on another PR, I came across this crash:

12-03 12:05:15.217 16688-16688/com.firebase.uidemo E/AndroidRuntime: FATAL EXCEPTION: main
                                                                     Process: com.firebase.uidemo, PID: 16688
                                                                     java.lang.IllegalArgumentException: Given String is empty or null
                                                                         at com.google.android.gms.common.internal.zzac.zzdv(Unknown Source)
                                                                         at com.google.firebase.auth.FirebaseAuth.fetchProvidersForEmail(Unknown Source)
                                                                         at com.firebase.ui.auth.ui.idp.CredentialSignInHandler.onComplete(CredentialSignInHandler.java:73)
                                                                         at com.google.android.gms.tasks.zzc$1.run(Unknown Source)
                                                                         at android.os.Handler.handleCallback(Handler.java:751)
                                                                         at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                         at android.os.Looper.loop(Looper.java:154)
                                                                         at android.app.ActivityThread.main(ActivityThread.java:6088)
                                                                         at java.lang.reflect.Method.invoke(Native Method)
                                                                         at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
                                                                         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

It's caused by this line of code and occurs if a user has an existing account and there is a FirebaseAuthUserCollisionException.

To solve this problem, there are two solutions:

  1. Check for a null email in CredentialSignInHandler and fail the sign in if the email is null.
  2. Use TwitterAuthClient#requestEmail to show the request email activity.

I prefer solution 2 because we are being more transparent about requesting a user's email, but it requires more steps and a Twitter user might not have an email: https://docs.fabric.io/android/twitter/log-in-with-twitter.html#request-user-email-address

@samtstern @amandle What should we do?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions