Facebook login box on my website API Error Code: 191

I wanted to add facebook login option on my website, but always getting,

An error occurred with Abhishekmiet. Please try again later.

API Error Code: 191 API Error Description: The specified URL is not owned by the application Error Message: Invalid redirect_uri: Given URL is not allowed by the Application configuration.

I'd set the following in my app setting: Site-url: http[://]ip_address Canvas url: http[://]ip_address/ (the square brackets removed after http) ip_address is my ip address in x.x.x.x pattern, have not posted my actual ip for security purposes.And i'm using the following php snippet for generating base url,

if($_SERVER['HTTP_HOST']=='localhost'){
$base_url='http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
}else{
$base_url='http://'.$_SERVER['HTTP_HOST'];  
}

I've tested it on both my local server and on my live server but always the same error.

Answers


Your base url is not complete. Try this...

$protocol = "http";

if(isset($_SERVER['HTTPS']))
{
    if($_SERVER['HTTPS'])
    {
        $protocol = "https";
    }
}
//Check if the protocol is HTTP or HTTPS

$domainName = $_SERVER['HTTP_HOST'];

$appNamespace = "fercheckin";
//Your namespace specified in your app settings

$appFolder = "it3196/tbfer/fercheckin/";
//Your Canvas/Page Tab URL (Example:http://localhost/it3196/tbfer/fercheckin/)

$fbconfig['appBaseUrl'] =   $protocol."://apps.facebook.com/".$appNamespace;
//For App on Facebook application

$fbconfig['baseUrl']    =   $protocol."://" . $domainName . "/" . $appFolder;
//For Page Tab application

This will work for App on Facebook and Page Tab application, on both local server and live server.


Need Your Help

Slider not working in IE8 and only IE8?

javascript jquery css xhtml cross-browser

For the past two weeks I have been trying to figure out why this slider isn't showing up in IE8? Can anyone shed some light on this please? http://thefoldingkayakcompany.com/

iPhone app crashes on startup

iphone objective-c

I had two apps in xcode, which i wanted to combine, so i started a new project and attempted to put the two apps together in this new one. Was this a really stupid thing to do?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.