Facebook Canvas App Login URL doesn't look like other logins - oauth

So this is a canvas app, intended to run in the FB chrome.
I'm using the FB php SDK.
I'm creating my login url by:
$loginUrl = $facebook->getLoginUrl( array('scope'=>'email,publish_actions', 'redirect_uri'=>$fbCanvas));
then using this script to redirect:
print "<script> top.location.href='" . $loginUrl . "'</script>";
Instead of seeing a "regular" fb app auth dialog, such as:
What I want to see
I get a dialog like this one:
What I see instead
Any ideas what I'm doing wrong?
If the new user clicks on the Okay button, they are logged into the app, redirected correctly and everything works ok, I just want it to look like / work like every other app.
Thanks!

Facebook is re-styling the Login dialog (again), see https://developers.facebook.com/docs/concepts/login/permissions-login-dialog/#login-dialog
As usual with Facebook, this rollout does not affect all users or all apps at the same time, but is gradually rolled out. So for a while users might see both versions of the login dialog, but eventually all apps will use the new one.

You are doing nothing wrong.
I suspect Facebook has changed the way it displays the Authorization/Permission window depending on the data available for the Application. If your application lacks 'App Detail', 'Image' , 'Privacy Policy Link' etc. then you get the authorization window as What major apps show else you would get the window you are getting right now.
Earlier there was no distinction as such but since this month it might have changed as I earlier used to get the full fledged Authorization window but not now.

Related

iPhone OAuth login request redirects to App not Browser, doesn't work

My current scenario is:
Running an iPhone on the latest iOS
LinkedIn App is installed and logged in
Web browser is NOT logged into LinkedIn (because I have the app)
Developing a web app with "log in with LinkedIn" functionality
On the iPhone, clicking the "log in with LinkedIn" button redirects me straight the the LinkedIn App, which subsequently does nothing - just shows me my feed. I have verified this same behaviour occurs on a third-party site as well as my own. Note that Android exhibits similar behaviour, though I haven't tested as extensively there.
I've found several workarounds:
If I open the web site in Private Browsing mode clicking the login button asks me if I want to open the App or stay in the browser.
If I long-press and "Open in background tab" the login button it'll open (in the background, of course) instead of redirecting to the app, allowing me to log in.
If I manually type "linkedin.com" into the browser and log in then it seems to work too.
None of these are even vaguely practical for end users, essentially forcing us to remove the option entirely.
I'm fairly sure this is a problem at LinkedIn's end and the solution is either:
Don't redirect to the App for OAuth Authorize requests, or
Make the App correctly handle OAuth Authorize requests.
If I'm incorrect and there's some way we can stop this redirect from the client side I'd be happy to hear, otherwise I hope LinkedIn engineers actually see this...
See the comments in Issues with Linkedin Social connection
LinkedIn already confirmed that it is a problem on their side.

Open web page and bypass login from iPhone - iOS

I want to open, from an iOS app, a web page that requires authentication in order to get to that page.
I googled a little bit and I believe I need to use WebKit and Javascript injection, but I am not sure and I have never done something like this, so every bit of information is welcomed or pointing me in the right direction.
I will give an example that I hope will make things more clear(I don't actually want to open facebook, it's just part of the example):
Is it possible to do the following scenario? And if yes, how?
Open a web page from an iOS app, for example: "https://www.facebook.com/profile" without having to go through the login page? I do have the user credentials(username and password), as the user is already logged in with those credentials in the iOS app, but the requirement is to not go through the login page, but to go straight to the profile page.
In general the answer is: no. Even if the user is already logged in and has a valid authentication token that token may only be valid from within your app and not from within the browser. And the login form may be protected by something like a captche preventing you from automatically logging someone in.
There certainly are situation where it is possible: For example if the tokens are not scoped to your app you can try passing them along. Or there is an actual API that you can call with the token that logs the user into the website on the website, etc. But those depend on the specific target website or wether you can control that target website and can add this functionality.

IOS 8 facebook sdk

i am working with the HelloFacebookSample from face book's sdk.
i have a few issues, but am trying to get through them.
The one i have right now is that after I login, then logout, then login again, i am automatically logged in without being asked for credentials. Is there any way to change this behavior?
And secondly (for now), is there any way i can bring up the FB login dialog within my app instead of it going to Safari? i don't want my users to have access to safari at all, so i need to keep control.
The original FB sdk (about 2 years old) handled the login directly from within the app, so I am thinking i am just missing something here?
Thanks,
Jerry
If you want full control over the login process then you can't use the SDK, you need to add and manage a web view yourself. Facebook tries to bother the user to reconfirm as little as possible, so it will provide a login with the least path of resistance (and user taps / interaction).
Depending on how the user is logged into Facebook you won't be able to force them to re-enter login details unless you implement the web view approach. If you're using the SDK then you would need to call closeAndClearTokenInformation on the active session and also delete any Facebook related cookies from the app (and that's probably as close as you can get).

Not redirecting to Facebook comments in UIWebView after login

I am adding facebook comments to my iPad application using UIWebView and HTML5 code provided by Facebook.
When the user is not logged in, the application shows the comments and button "Login to Facebook to Post a Comment".
Clicking the button takes me through login process. After the login completes the view is redirected with an empty page with "Login complete" message. It is not redirected back to the comments dialog.
Right now I implemented an ugly workaround. Upon receiving webViewDidFinishLoad event, I look at contents of the page and reload it if the page shows this message. Though, it does not seem a clean way to go.
Why doesn't Facebook redirect me back to original comments page?
I suspect the problem you're having is related to this issue: Facebook authentication in a UIWebView does not redirect back to original page on my site asking for auth
Specifically, the standard Facebook web login process launches a new browser window dialog, and dispatches a message back to the opener to indicate login success for the redirect to occur.
Quoting a passage in the linked SO, "UIWebView doesn't support multiple windows so it can't postMessage back to your original page since it's no longer loaded."
I'm also developing an iPad application, and my solution is similar to yours: i drive the user to "https://m.facebook.com", always, to force him to login first, then in "webViewDidFinishLoad" i inspect the returned url and if it matches:
"https://m.facebook.com/login/checkpoint/"
exactly, that is, the url returned upon a successful login, then i call my own method (with reload or anything i want). At this time, the user is authenticated and has a valid FB session, so, redirections are not necessary anymore.
It's definitely not pretty, and may break as soon as FB changes the way it processes the login dialog, but i too cannot find a way to resolve it any better. Even tried using "FB.Event.subscribe('auth.login', function(response) {});" without success, of course, because the code is never reached.
I think a bug is already submitted to FB, but i don't think it's getting the deserved attention...
I ran into same issue as this question, but after reading some Facebook official documentation, I'll be redesigning to use the Facebook native SDK.
All iOS and Android apps must (effective October 2, 2013) use our SDKs
for iOS and Android for requesting permissions.
Though, I also gather that the "or else" is just a "developer notification"?
Posting this in hopes it will save time for someone using the same approach :)

Facebook app iframe won't attempt to load when logged in as page

I have an app that shows up as an iframe on a Page. (Here's an example.)
If you view the app tab as a Facebook user, whether you have the app installed or not, everything works correctly.
If you view the app tab as a Facebook Page that has not installed the app, everything works correctly.
If you view the app tab as a Facebook Page that has installed the app, nothing displays. In fact, when sniffing the HTTP headers, it looks like no attempt is ever made to load the app URL.
Any idea what needs to happen on the Facebook side of the equation in order to have the tab at least make an attempt to load the app's page?
Thanks!
This is now a desired behavior, once you trying to visit Application Tab by being logged in as Page you'll be prompted to use Facebook as regular user:
To access this page, you'll need to switch from using Facebook as your page to using Facebook as yourself.
BTW, this was described in bug Blank app page which is marked as fixed (and the described behavior sadly was a way to fix this)...

Resources