Facebook iOS SDK: login for blocked app gives error - "The Page you requested cannot be displayed right now. It may be temporarily unavailable..." - iphone

My app uses Facebook iOS SDK 2.0 for Sign up through Facebook involving publish_stream params as permissions. Now if a FB User authorizes the application for Sign Up it works perfectly fine. I am displaying the login dialog box in app without switching to safari and store accesstoken and other credentials required.
However, following test case gives errorneous result--
TEST Scenario :
STEP 1 : The same user later on Blocks the application from the app activity on wall.
STEP 2 : Now he goes to the iOS App and performs the FConnect i.e. calls the login dialog.
STEP 3: User enters his correct facebook credentials and clicks on 'login'.
Result : The WebView loaded reflects the following error message: "The page you requested cannot be displayed right now. It may be temporarily unavailable, the link you clicked on may be broken or expired, or you may not have permission to view this page." with a Facebook Application logged in.
Can this response from Facebook Server be checked and handled at the client end?

Related

Facebook sending authorized signed_request after removing app

I'm developing a facebook canvas app and for testing purposes, sometimes I go to my account settings and delete the app (to force re-authorizing the app).
The problem I'm facing is that even after I do this, when I access the app, facebook still sends me a signed_request with user_id and a valid oauth_token, as I had authorized the app.
Is there any cache or delay for facebook to take my removal into account?
What could have been happening?

Facebook App not redirecting to log in page

When the user is not logged in and goes to apps.facebook.com/my_app_name_here Facebook redirects to a "Use of app "MY APP NAME HERE" has been restricted" page (if I log in first it works fine).
I don't see the request hitting my server at all. Is there anything I have to do on my app settings to get it to work correctly. Games like cityville redirect to the login page correctly and then bring you back to the app page when logged in.
This is probably happening because your app has restrictions configured. Check the restrictions in the "Advanced" tab of your app's settings in the Developer App.
When the user is not logged in, Facebook cannot tell if the user is subject to any of your configured restrictions and so must display a message that it is restricted.
For example, if your app is restricted to ages 21 and older, Facebook cannot determine the age of the user until he/she is logged in.

$facebook->getUser when user is using FB as a page

OK, so my application works fine and dandy, but I recently discovered a problem when a user is logged in "as a page". When the user is logged in as a page and goes directly to the app base url... i.e. apps.facebook.com/... it correctly identifies that the user object is incorrect and sends the user to:
https://www.facebook.com/login/roadblock.php?target_url=...
This makes the user login as the actual FB user, and it works well.
But it does not do this on the app's page tab. It just redirects to:
https://s-static.ak.facebook.com/platform/page_proxy.php?v=4
Is there a command or function in the PHP SDK that can check if the user is using as a page, and redirect them to the referred page?
There is currently no way to check if user logged in as page due to fact that Facebook doesn't provide this information and prompting to switch back to usage of regular Facebook account on any interaction with applications.

iOS Facebook Login but not Connect?

today I've an hard question that it causes me some problems.
I'm beginning to implement, for the first in my life, the Facebook Login/Connect in my iOS application.
What's strange? Nothing so far, except I want that the users can ONLY login in the app with Facebook Login, not signup. I explain better: only the users that are already registered in my website can use Facebook Login for logging in.
Website: users can signup with Facebook Connect
iOS app: users can use Facebook Connect only if they're already connected in the website with Facebook Connect.
Is it possible or is an illusion? For example if there's a way to get the facebook uuid of the logged user before show the permission popup it would be great, because I check for this uuid in my database and if exists I'll allow to connect the user.
On the website side
Your user logs in, then authorizes to use your app. As soon as she is authorized, add her user id to your database.
On iOS side
Your user logs in. As soon as she logs in you have access to her user id. So, before showing the main app screen display a loading graphic. Send a request with the user id to your server. The server replies that she is authorized and you proceed to show your main app screen. OR, the server replies that she is not authorized and you proceed to show an error message that instructs the user to first authorize on the website (maybe this screen should have a retry button).
if i get your question .. you can build an Api_service on your website through it you can send the user email from the application and check if this mail registered on your website .. so before the user login to Facebook you make a request to call this api > you returned a value to your app tell you that the user is registered in your site or not .. so then you can allow just the user's you want to login fb.

Facebook Permissions Dialog in Page

I've created an app that works fine, however if the user has not authorized my app yet, they have to do the following (assuming they are in facebook AND logged in) -
go to my app
click login/authorize
popup with facebook permissions opens
accept in the popup
However I noticed with Zynga games like Mafia Wars 1/2, Farmville etc, when you go to the app, if it hasn't been authorized, it takes you straight to the permissions which is in a PAGE and not a popup, thereby eliminating one step. Also, the permissions dialog is full width, there is not app sidebar.
Does anyone know how I can duplicate this flow? It would be much easier to have users authorize within a facebook page rather than through a popup. How can I get permissions inside the page?
thanks in advance
Once user visit a Page tab with your application you can check if he is connected with your application by comparing Page ID with User ID in signed_requests, for unauthorized users ID's will be same. In that case you can start authentication flow by redirecting user's browser to "login url".
If you want it to be full page just do the redirect with JavaScript like this:
window.top.location = 'https://www.facebook.com/dialog/oauth?
client_id=YOUR_APP_ID&redirect_uri=YOUR_URL&scope=COMA_SEPARATED_PERMISSIONS'
If you using PHP you can construct Login URL by calling Facebook->getLoginUrl method.
Read the docs on Facebook authentication