Skip to content

Instantly share code, notes, and snippets.

Last active Mar 9, 2020
What would you like to do?
Firebase Auth - Password-less Email - Demo
implementation ''
implementation ''
<uses-permission android:name="android.permission.INTERNET"/>
private FirebaseAuth mAuth;
mAuth = FirebaseAuth.getInstance();
ActionCodeSettings actionCodeSettings;
actionCodeSettings = ActionCodeSettings.newBuilder()
.setAndroidPackageName("com.droidmentor.firebaseservicesdemo", false, null)
mAuth.sendSignInLinkToEmail(emailID, actionCodeSettings)
.addOnCompleteListener(new OnCompleteListener<Void>() {
public void onComplete(@NonNull Task<Void> task) {
Log.d(TAG, "onComplete: ");
if (task.isSuccessful()) {
Log.d(TAG, "Email sent.");
} else {
System.err: An internal error has occurred.
[ UNAUTHORIZED_DOMAIN:Domain not whitelisted by project ] Please activate Dynamic Links in the
Firebase Console and agree to the terms and conditions.
<activity android:name=".MailAuthenticationActivity">
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:host="" android:scheme="https"/>
Intent intent = getIntent();
String emailLink = intent.getData().toString();
mAuth.signInWithEmailLink(emailID, emailLink)
.addOnCompleteListener(new OnCompleteListener<AuthResult>() {
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
Toast.makeText(activity, "Successfully signed in with email link!", Toast.LENGTH_SHORT).show();
if (task.getResult() != null && task.getResult().getUser() != null) {
FirebaseUser user = task.getResult().getUser();
if (!TextUtils.isEmpty(user.getUid()))
Log.d(TAG, "signInWithCredential: " + user.getUid());
// For example use *es* for Spanish
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment