1

I got this error in the Chrome's console when using Javascript SDK to implement the Facebook login:

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.

I tried to call the FB.getLoginStatus function and then the error happend. I already researched Question 1 and Questions 2 and followed instructions and still cannot resolve this error.

The url of the page which calling the function is: http://channels.daily.sg.tripolis.vn/channels#/new/add_channel_a (I'm using AngularJS)

This is my App's setting: https://drive.google.com/file/d/0Bya9VnleW-F-TUhWRUZhX3Rxb2M/view?usp=sharing

and this is my AngularJS code to setup the SDK:

this.tokyo = angular.module('tokyo');
this.tokyo.run(['$rootScope', '$window',
  function($rootScope, $window) {
    $window.fbAsyncInit = function() {
      // Executed when the SDK is loaded

      FB.init({
        appId: '570857916302626',
        cookie: true,  // enable cookies to allow the server to access
        xfbml: true,
        version: 'v2.4' // use version 2.2
      });

    };

    // Load the SDK asynchronously
    (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 = "//connect.facebook.net/en_US/sdk.js";
      fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));

    // Here we run a very simple test of the Graph API after login is
    // successful.  See statusChangeCallback() for when this call is made.
  }]);
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js"></script>

What did I do wrong ?

Vu Truong
  • 11
  • 1
  • Specify “Valid OAuth redirect URIs” on the “Advanced” tab. – CBroe Sep 15 '15 at 12:15
  • You mean I should put the url http://channels.daily.sg.tripolis.vn/channels#/new/add_channel_a into “Valid OAuth redirect URIs” ? I did it and still cannot resolve the error. I actually can't understand what the "Given URL" is. – Vu Truong Sep 16 '15 at 03:22
  • “Given URL” is the one used as value for `redirect_uri` parameter in the login dialog call. If you did not specify it yourself, then it was done by the SDK, automatically based on what page you are currently on. I’d suggest you try a URL without the hash part. – CBroe Sep 16 '15 at 07:40
  • You saved my day! I just put the url: http://channels.daily.sg.tripolis.vn/channels into “Valid OAuth redirect URIs” and it works! Thank you so much! – Vu Truong Sep 17 '15 at 07:28
  • OK, I added that as an answer. – CBroe Sep 17 '15 at 08:49

1 Answers1

0

You might need to specify “Valid OAuth redirect URIs” on the Settings->Advanced tab in your app dashboard.

The “Given URL” the error message talks about is the one used as value for the redirect_uri parameter in the login dialog call. If you did not specify it yourself, then it was done by the SDK, automatically based on what page you are currently on.

I’d suggest you try a URL without the hash part for “Valid OAuth redirect URIs”.

CBroe
  • 86,812
  • 12
  • 88
  • 140