Search code examples
androidfirebasefirebase-authenticationfirebaseui

Given URL is not permitted by the application configuration using FirebaseUI


Using Firebase and the FirebaseUI Android app which is used to demo Authentication.
The Facebook login is failing with the error:

Given URL is not permitted by the application configuration.: One or more of the given URLs is not allowed by the App's settings. To use this URL you must add a valid native platform in your App's settings

Following the instructions in the Firebase documentation I have

  1. added and enabled my Facebook app.
  2. copied the App ID and the App secret from Facebook to the Firebase console
  3. copied the OAuth redirect URI from the Firebase console to the Facebook Dashboard in to the Valid OAuth redirect URIs, eg https://my-test-1234.firebaseapp.com/__/auth/handler
  4. set the Facebook App ID in the values/config.xml file inside the android demo app.

I have also looked at similar, but old StackOverflow questions and googled for solutions so I have also, in the Facebook Dashboard, added

  1. the app domain in the App Domains field
  2. a platform as Website with the URL from the Firebase console - the same as the OAuth redirect URI, eg. https://my-test-1234.firebaseapp.com

I am guessing a bit here because there isn't any specifics in the Firebase documentation about the Facebook setup, and the Facebook Dashboard have changed recently.
Also, this is an Android app but the Facebook login implementation using FirebaseUI for Android — Auth is different compared to the normal implementation of Facebook Login for Android. This is why I added the platform as a Website and not as an Android app, in the Facebook Dashboard.


Solution

  • To get FirebaseUI Android App working with the Facebook Auth you need to add Android as a platform inside the In the Facebook Dashboard. FacebookAndroidPlatform This is the missing step in the Firebase documentation.
    (The Website platform is not needed and the App Domains field can be empty).

    Also note that the option Web OAuth Login should be "Yes" (the other options can be "No") This is located next to the Valid OAuth redirect URIs. field. AuthOption