idoshveki
idoshveki

Reputation: 193

ionic app- Given URL is not allowed by the Application configuration

Im developing an app with ionic and FB graph api.

when debugging and running on my browser everything seems fine, but on my android device it's not : the funtion "FB.getLoginStatus(...." won't return, and when debugging with adb i get the following error message:

"Given URL is not allowed by the Application configuration: One or more of the given URLs is not allowed by the App's settings. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains."

if it's a configuration issue from the facebook developers console, i'de appreciate it if you'll be specific with the fields that should be filled)

parts of my code: (app.js)

window.fbAsyncInit = function() {
    FB.init({
      appId      : '1443507049279750',
      xfbml      : true,
      status     : true,
      cookie     : true,
      version    : 'v2.3'
    });
    console.log("ghghghg");
    isInit = true;
  };


  (function(d, s, id){
     var js, fjs = d.getElementsByTagName(s)[0];
     if (d.getElementById(id)) {return;}
     js = d.createElement(s); js.id = id;
     //js.src = "http//connect.facebook.net/en_US/sdk/debug.js";
     js.src = "https://connect.facebook.net/en_US/sdk.js";
     fjs.parentNode.insertBefore(js, fjs);
   }(document, 'script', 'facebook-jssdk'));

and inside one of the controllers :

$scope.fbLogin = function() {
            FB.getLoginStatus(function(response) {
                console.log(response.status);

              if (response.status === 'connected') {

                    $User.initUser();

                    $state.go('tab.dash');

              }  
              else{ 

                    FB.login(function (response){
                        console.log("hg");
                        console.log(response);
                    }, {scope: 'email,public_profile,user_friends'});
              }

            });     
    }

thanks very much !

Upvotes: 1

Views: 504

Answers (1)

Jan Corluy
Jan Corluy

Reputation: 36

You need to change the *info.plist file in the platform directory (ios/facebook_login/*info.plist) There you need to have:

<key>FacebookAppID</key>
<string>your_appid</string>
<key>FacebookDisplayName</key>
<string>your_displayname</string>
<key>URL types</key>
<array>
 <dict>
 <key>URL Schemes</key>
   <array>
    <string>fb597296183741619</string>
    </array>
   </dict>
</array>

Upvotes: 2

Related Questions