Apple Login with Flutter and Firebase is not saving the private relay emails

155 views Asked by At
We are allowing login via Apple in our Flutter/Firebase app.


Following these instructions we have enabled apple as a sign in provider:

enter image description here

The sign in via apple all works fine,
However we are not getting the private relay email saved in the Authentication in Firebase,
instead it is coming through as null:

enter image description here

What do we need so that the private relay email comes through via an Apple sign up?

1

There are 1 answers

1
Mark Durst On

The email is found in the additionalUserInfo when signing in. I haven't found a way yet to let firebase set the email and I the only way I found, was to set it manually like this:

final userCredential = await auth.signInWithProvider(
          AppleAuthProvider().addScope('email'),
        );
final email = userCredential.additionalUserInfo?.profile?['email'] as String;
userCredential.user?.verifyBeforeUpdateEmail(email);

This of course implies that a verification email with link is sent, on which the user has to click.