facebook authentication error - php

I am Developing a simple Facebook Application in php which displays only name of the user of the application.
Facebook authentication dialog that appears whenever a facebook user joins an app is not appearing with the programming code I dowloaded from link https://github.com/facebook/php-sdk officially provided at facebook app developer page.
I have dowloaded some other app codes which has wrong authentication code.
I am facing 2-3 errors, in some cases the canvas page of the application is refreshing itself again and again and in the other case authentication window appears, but when one clicks on "Allow App" the page is redirected to application page that is loaded on the server and on clicking "Don't Allow" the page is redirected to canvas page instead of coming back to home page of user.
is the php-sdk library that i have downloaded is outdated or there is any other problem.
please anybody who has tested code provide the with solution coz i have tried a lot of readymade applications already (all has sane problems). i just require a working authentication code with correct php library

THe source code from the official PHP sdk site is working.... yet, it is expected that in the provided sample code, the authentication flow is not kicked off automatically. You can verify that by going through the code.
there are a few community generated tutorial listed in http://forum.developers.facebook.net/viewtopic.php?id=79787. You may find them useful.

Related

Facebook Graph API stopped recognizing publish_action scope

I'm trying to upgrade an integration with the Facebook Graph API from version 1 to version 2.0, but I'm facing a problem: The permission publish_actions is not being shown in the dialog for granting.
I'm doing it manually (without the JS SDK).
PHP code:
header('Location: https://www.facebook.com/v2.0/dialog/oauth?client_id='.$appID.'&redirect_uri='.urlencode($callBackUrl).'&scope=publish_actions,offline_access');
exit(0);
Does anyone know what is happening? I've been looking for a solution for hours. As I already said, I had a working app at the Facebook from the previous version, and the Facebook API didn't show me any alert.
I assume that all configurations are correct, or at least they seem to be.
Currently, the Facebook requests reviewing your app when it uses non-basic permissions like "publish_action". If you need to use these permissions, you will need to submit your app to be reviewed by Facebook's team. Only after that the permission will be shown to your app users.
For submit your app, access your app at https://developers.facebook.com/apps/, and after clicking at your app button, click at the button "Status & Review" at the left menu, fill the form and submit it. Within 5 business days you will be notified about the reviewing result.
Another thing that has changed is that non-basic permissions are only shown to the user after he approves the basic permissions.
Furthermore it's allowed to use your own user to test the app (with all permissions, including non-basic's) before submit it.

Login with facebook using php sdk not working

I'm using facebook's php sdk for a login system on localhost. It was working fine without any problems. But when i try to login now, after clicking the login button it just brings me back to the same page without actually logging me in and changes the url to something like this:
http://localhost/test.php?code=AQA6J5GuQQFCpc9mkOOmuR2...etc
I have double-checked all the code and all the source php sdk files needed. They are all there and haven't been changed from the last time i was able to successfully login. But for some reason it isn't working. Can someone please help me out.
As far as I can see Facebook requires the registration of your web site for the ap, to prevent hackers.
Therefore I don't think it can ever work if your running it on localhost, it would have to run on a domain name.

IOS HTML5 app Facebook Login failure when 'Add to Home' screen used

I have been working on a website that has a mobile version. Integrated into the site is a bit of code that allows users with FB to register without having to fill out a form. If the user meets any of the following conditions all is well
Uses ANY desktop browser
Users ANY mobile browser
The FB just works. However as soon as I do an 'Add to Homescreen' with IOS to make the app look and perform like a native app, when anyone uses the FB signup I get the
'Given URL is not permitted by the application configuration: One or more of the given URL's is not allowed by the Apps settings. It must match the Website URL or the Canvas URL, or the domain must be a subdomain of one of the App domains'
I am assuming that once you use the add to home screen, and the app gets its own instanced browser, the URL changes, likely some form of localhost derivation maybe?
I can't find any definitive answers to fixing this, and was wondering if anyone else had experienced this HTML5 IOS app problem?
Looks like the dev of the extension I was using will be working on a different authentication flow, so not giving this any more dev time

Facebook Login Screen in different Locale

I have a php application which uses facebook php sdk to integrate Facebook login within the app. I have 5 versions of the app with 5 language settings, but the problem is the facebook Login popup page always opens in English and pop-up opening handler is part of SDK itself, I cant figure out which configuration would lead to the solution.
Earlier, I had managed to show the "Log in to Facebook" button in 5 different languages by including 5 different Javascripts. But I could not find any solution opening the Login Screen in various Languages... Please help
I recommend to use Javascript SDK for login. In Javascript SDK you can load different SDK's which have different locales. Just look at this url: connect.facebook.net/en_US/all.js
Change en_US to any locale. So login screen will be localized as you wish.
Update:
It seems that facebook later decided to change this behaviour. According to internationalization document and this blog applications cannot control facebook's locale. Only thing you can do is checking user's locale and adapting your application's locale to Facebook's.

Facebook Connect - Mobile

I am currently in the process of creating a mobile version of my web app.
The app is being developed with Facebook's PHP Client Library.
The issue:
I am using the following mobile url to allow users to log in using the mobile devices:
http://m.facebook.com/tos.php?api_key=APIKEY&v=1.0&next=http%3A%2F%2Ftweelay.net%2Fm.php&cancel=http%3A%2F%2Ftweelay.net%2Fm.php
APIKEY being my app's actual Facebook API key.
In the url I am telling Facebook to redirect the user back to http://tweelay.net/m.php when the user signs in or clicks cancel on the log in screen. I am pulling my hair trying to figure out why it keeps sending the user to http://m.tweelay.net/m.php which is currently an invalid end point.
I have gone through all of my app's settings on Facebook and I cant find any that reference http://m.tweelay.net and going through all of my source code I cant find any that reference the m. sub-domain either.
Any ideas? Is there a setting I'm missing? Maybe a Flag in the library?
I've seen Facebook do this when detecting the mobile browser type and also sometimes randomly through Firefox (it can also happen when trying to get to facebook.com). I've managed to reset it sometimes, but it's not a guaranteed fix.
If you want to be sure the user makes it to your correct site I suggest creating the subdomain and redirecting traffic to your usual site, it's what I did and now I don't worry about it reverting back.

Categories