Now, I'm following this - (https://firebase.google.com/docs/auth/android/email-link-auth)
Using this code,
ActionCodeSettings actionCodeSettings =
ActionCodeSettings.newBuilder()
// URL you want to redirect back to. The domain (www.example.com) for this
// URL must be whitelisted in the Firebase Console.
.setUrl("https://MYPROJECTNAME.page.link/SOMESTRING")
// This must be true
.setHandleCodeInApp(true)
.setAndroidPackageName(
"com.example.MYPROJECTNAME",
false, /* installIfNotAvailable */
"12" /* minimumVersion */)
.build();
I sent email successfully.
I set URL with Dynamic Link I made, "https://MYPROJECTNAME.page.link/..."
.
And when I open the link in email, my app is opened successfully.
But I have a problem with this code
FirebaseAuth auth = FirebaseAuth.getInstance();
Intent intent = getIntent();
String emailLink = "";
if( intent.getData() != null ){
emailLink = intent.getData().toString();
Log.d("DYNAMIC", "INTENT: " + emailLink);
}
else{
Log.d("DYNAMIC", "No INTENT");
return;
}
// Confirm the link is a sign-in with email link.
if (auth.isSignInWithEmailLink(emailLink)) {
.
.
.
}
auth.isSignInWithEmailLink(emailLink)
returned false, so cannot login.
When app is opened with the link in email, I checked intent.getData().toString()
(String emailLink) with Log.d() and it was "https://MYPROJECTNAME.firebaseapp.com"
.
Maybe It is wrong emailLink with isSignInWithEmailLink()
...
Is there something that I missed?
Read more here: https://stackoverflow.com/questions/66998189/authenticate-with-firebase-using-email-link-in-android
Content Attribution
This content was originally published by cyj89317 at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.