Search code examples
javascriptfacebooksingle-sign-onibm-cloud

Facebook javascript api - One or more of the given URLs is not allowed by the App's settings


I have a simple application that I'm hosting on bluemix.

I have set up a Single Sign On service for my application and paired it with facebook. I can successfully log in using the SSO service from bluemix and then I want to check that status of my login (I am logged in or not).

function CheckStatus(){
    console.log("I'm trying to check the status");
    FB.getLoginStatus(function(response) {
        console.log("Here is the status response:");
        console.log(response.status);
    });

 }

I trigger this piece of code with a simple button defined before. Whenever I click the code I get the following 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. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains.

I had a look at a number of posts on stackoverflow about this and none of them seem to work. My understanding is that there is something wrong with the configuration of my application but I can't figure out what.

Below is my configuration: enter image description here

And this is the url my application is trying to reach when I try to get my login status:

https://www.facebook.com/connect/ping?client_id=913147408730179&domain=fncsecuritydemo.mybluemix.net&origin=1&redirect_uri=http%3A%2F%2Fstatic.ak.facebook.com%2Fconnect%2Fxd_arbiter%2FrFG58m7xAig.js%3Fversion%3D41%23cb%3Df29b5c6b3%26domain%3Dfncsecuritydemo.mybluemix.net%26origin%3Dhttp%253A%252F%252Ffncsecuritydemo.mybluemix.net%252Ff21657f8dc%26relation%3Dparent&response_type=token%2Csigned_request%2Ccode&sdk=joey

I am out of ideas about what I should be trying next. Any help is very much apreaciated. Let me know if you need more info.


Solution

  • The answer for this error lies in the Valid OAuth redirect URIs that fall under the Advanced tab from settings.

    While setting up the application profile on facebook I have set the Valid OAuth redirect URIs to an URL generated by bluemix.

    In order to received response on my application I had to add my app url in there as well. Rookie mistake.

    enter image description here