Domain Error UNAUTHORIZED_DOMAIN:Domain not whitelisted by project

Asked

Viewed 28 times

1

I am developing an application in which I wish to authenticate (login), via e-mail without password. I didn’t get much current documentation on this, so I took the firebase example itself on github.

The problem is that when I put the email, it returns an error in my Log:

com.google.firebase.Firebaseexception: An Internal error has occurred. [ UNAUTHORIZED_DOMAIN:Domain not whitelisted by project ]

I’ve done a lot of research on this bug, and what they respond to is that domains need to be updated.

I don’t have a paid domain, so I’m using the ones generated by Firebase itself.

The encodings are as follows::

Android Manifest

<activity android:name=".Activities.Login">
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT"/>
                <category android:name="android.intent.category.BROWSABLE"/>
                <data
                    android:host="https://telefones-c6ce7.web.app/"
                    android:scheme="https"/>
                <data
                android:host="http://telefones-c6ce7.web.app/"
                android:scheme="http"/>

                <data
                    android:host="telefones-c6ce7.firebaseapp.com"
                    android:scheme="https"/>
                <data
                    android:host="telefones-c6ce7.firebaseapp.com"
                    android:scheme="http"/>

                <data
                    android:host="telefones-c6ce7.web.app"
                    android:scheme="https"/>
                <data
                    android:host="telefones-c6ce7.web.app"
                    android:scheme="http"/>

                <data
                    android:host="localhost"
                    android:scheme="https"/>
                <data
                    android:host="localhost"
                    android:scheme="http"/>

                <data
                    android:host="https://a0800restinga.page.link"
                    android:scheme="https"/>
                <data
                    android:host="http://a0800restinga.page.link"
                    android:scheme="http"/>
            </intent-filter>
        </activity>

see that I put up several domain links that I found interesting to test.

By clicking on my button, it has the following 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(url)
                        // This must be true
                        .setHandleCodeInApp(true)
                        .setAndroidPackageName(
                                "com.joel.a0800restinga",
                                true, /* installIfNotAvailable */
                                "1.2.6"    /* minimumVersion */)
                        .setDynamicLinkDomain("a0800restinga.page.link")
                        .build();


        firebaseAuth.sendSignInLinkToEmail(email, actionCodeSettings)
                .addOnCompleteListener(new OnCompleteListener<Void>() {
                    @Override
                    public void onComplete(@NonNull Task<Void> task) {
                        Log.d(TAG, "email? " + email);
                        //Void v = task.getResult();
                        //Log.d(TAG, "void is " + v);
                        boolean emailWasSent = task.isSuccessful();
                        if (emailWasSent) {
                            Log.d(TAG, "Email sent.");
                        } else {
                            Exception e = task.getException();
                            Log.d(TAG, "There was a problem");
                            Log.e(TAG, "msg ", e);
                        }
                        setText(emailWasSent);
                    }
                });

where, the seturl I am generating, and directs correctly as I have already analyzed in the click. I believe the other information is correct.

Finally, I already included the SHA-1 and SHA-256 keys in my project and inserted the json in the application.

I’m testing everything via emulator.

in Firebase settings, I have dynamic links and all are valid: enter image Description here

In authentications, I have only this asset: enter image Description here

and these are the authorised areas:

enter image Description here

I thank anyone who can help me

  • Joel, how are the login access settings? Did you add "localhost" as the Oauth redirect domain? On the Firebase Auth screen, after authentication methods, see if localhost is in the authorized domains section.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.