Facebook friend dialog not working on mobile - facebook

Prologue:
I have about the same problem as described in the previously asked question (FB add friend dialog on mobile doesnt work).
But since there is no real solution to this problem made known other than the comment:
"it started working ... I didnt change anything." [...] (#dinodsaurus)
I'm asking it again. With some extra information specific to my case.
I'm using the facebook friend dialog by redirecting (302) to an URL like: (https://www.facebook.com/dialog/friends/?id=3500194&app_id=531355753613866&redirect_uri=http%3A%2F%2Fstackoverflow.com%2Fquestions%2F19403197%2Ffacebook-friend-dialog-not-working-on-mobile%23success)
The above URL works fine on both a desktop and a mobile browser.
Facebook automaticly redirects the before mentioned URL to their m.facebook.com domain while using a mobile device/browser. This renders the display=touch version of the dialog (see dialog reference).
This all seems very normal (and is actually wanted behavior).
But... it goes wrong when I confirm that I want to send the friend request. And only when I confirm it using a mobile device.
The message that I get after confirming on my mobile is:
"Sorry, something went wrong.
We're working on getting this fixed as soon as we can."
(Be sure to use your phone's browser for the above link or directly visit m.facebook.com using this link to reproduce the error.)
OK, so I waited two days now since I sent a bugreport (I found out I actually didn't do it the right way but I guess it's already filed before) for this error to Facebook and it seems like there is no fix. Also it seems to me that it's not likely they leave this broken for such a long time. Unless...
Main question:
So my question is actually:
Does anybody know of any reason that Facebook might have for possibly not fixing this error? And if so, is there any way around this while still using a reasonable display style for mobile devices?
Examples of solutions are very welcome... ;)
Edit:
I just filed a Repro for this bug. If you can reproduce the error that I describe here please file a Repro yourself at: https://developers.facebook.com/bugs/309157325894924 so as to give this bug more priority.

As answered by Wimagguc in this question you may try this:-
The underlying problem is that the Facebook API is not yet ready for
all the display types, and the friends dialog cannot be shown for the
mobile display.
protected static String DIALOG_BASE_URL = "https://m.facebook.com/dialog/";
protected static String DIALOG_BASE_URL_FOR_MISSING_SCREENS = "https://www.facebook.com/dialog/";
public void dialog(Context context, String action, Bundle parameters,
final DialogListener listener) {
boolean missingScreen = action.contentEquals("friends") ? true : false;
String endpoint = missingScreen ? DIALOG_BASE_URL_FOR_MISSING_SCREENS : DIALOG_BASE_URL;
endpoint += action;
parameters.putString("display", missingScreen ? "popup" : "touch");
parameters.putString("redirect_uri", REDIRECT_URI);
if (action.equals(LOGIN)) {
parameters.putString("type", "user_agent");
parameters.putString("client_id", mAppId);
} else {
parameters.putString("app_id", mAppId);
}
if (isSessionValid()) {
parameters.putString(TOKEN, getAccessToken());
}
String url = endpoint + "?" + Util.encodeUrl(parameters);
if (context.checkCallingOrSelfPermission(Manifest.permission.INTERNET)
!= PackageManager.PERMISSION_GRANTED) {
Util.showAlert(context, "Error",
"Application requires permission to access the Internet");
} else {
new FbDialog(context, url, listener).show();
}
}

Facebook decided that the bug has no priority and changed the status to "Won't Fix" at December 7th, 2013.
The original bug report was marked as a duplicate of https://developers.facebook.com/x/bugs/309157325894924/. See this page for more info.
I think this is a shame and I would still like to urge anyone who thinks the same to open a new bugreport for the issue. Or leave a comment on the report stated above. Since this seems to be the only way to create some sense of urgency for solving this problem.
PS: I recommend a bugreport since my comments were deleted lately.
PS2: Even my bugreport "to state the won't fix issue in the documentation" seems to be ignored. So every day new people will research the possibilities of a mobile web app with a connection to facebook and will wrongly assume they can use the "facebook friend dialog" in their web app on mobile devices. My hope is that they will find this page during their research, and steer clear off that assumption.

Related

firebase dynamic links in stripe throws err_unknown_url_scheme

I've been developing an app with firebase and stripe payment. I've created a checkout session in stripe and added firebase dynamic links for the success_url and cancel_url. The URLs are working fine. I've tested them outside stripe with a simple html file and it opens the app and takes the user to the correct page. If the page doesn't exist it'll take the user to the assigned website. This is stripe checkout session code:
const session = await stripe.checkout.sessions.create({
line_items: [{
price_data: { currency: 'INR', unit_amount: amount, product_data: { name: 'name' } },
quantity: 1,
}],
mode: 'payment',
success_url: 'https://-------.page.link/payment-success',
cancel_url: 'https://-------.page.link/payment-failed',
payment_intent_data: {
application_fee_amount: fee
},
}, {
stripeAccount: req.query.stripeId,
});
I've changed up the actual link since I don't know how much I'm allowed to share. But I can guarantee the dynamic links works fine. But after payment, the test payment at least, it's suppose to open the app and take the user to a payment success page. AND it was working fine for the first 2 or 3 days. After payment it re-opened the app and took the user to the correct page. But when I tried a few days later, this is what it's taking us to:
Again, I've removed the link since I don't know how much I'm allowed to share. It won't even open the app right now. It just shows this message in the browser. Both success and cancel url are doing the same. Why does the links work outside the function but not in it? Has anyone ever faced any similar issues before? Any help will be greatly appreciated.
It seems like you're trying to open the Checkout Session in a WebView which causing the issue in the redirect. Webviews don't know how to handle an URL Scheme other than http:// or https://. That being said, your problem isn't uncommon and there are multiple ways of solving this.
Your first approach would be to open the Checkout Session in an external browser as described in this answer or try to create your own WebViewClient and override shouldOverrideUrlLoading method like described in this answer. Just note that since the last edit of that answer the signature of the shouldOverrideUrlLoading method has changed but the logic should still be used the same way but instead of dealing with the String url, you will have to deal with a WebResourceRequest.
Had the same issue. I solved it by changing the mode like following:
await launchUrl(
url,
mode: LaunchMode.externalApplication, // Add this line
)
url_launcher version => 6.1.7

Facebook graph user picture won't show on mobile devices

I use the url https://graph.facebook.com/{app_user_id}/picture?width=120&height=120 to show the user picture on my app, but since this morning, it has stopped working on mobile devices.
Now, the same url redirects to https://lookaside.facebook.com/platform/profilepic/?asid={app_user_id}&height=120&width=120. This url works on desktop web, but on mobile it redirects again to https://m.facebook.com/platform/profilepic/?asid={app_user_id}&height=120&width=120 and the mobile web refuses to output the image. If I try to load it in the address bar, it is downloaded instead of showed.
I have searched for any change on the Facebook graph api about this but didn't find anything. Any hint to solve this? Thanks.
This seems to be a bug. Started happening to my app earlier on this morning. Still no fix as of yet.
A few bug reports that have been submitted on Facebook for Developers:
Profile Pictures Can't Load
Graph API Profile picture doesn`t work on mobile
Cross site policy error while accessing graph pictures
I faced the same issue today and I'v found a solution for that and it worked for me.
After login we get below Profile pic URL
http://graph.facebook.com/11111111111/picture?type=large&height=320&width=420
11111111111 is your social id/facebook id
now we need to change this URL in order to display image,
here is the code.
try {
profile_pic = new URL("https://graph.facebook.com/" + id + "/picture?type=large");
Log.i("profile_pic", profile_pic + "");
Picasso.with(getContext()).
load(profile_pic.toString())
.placeholder(R.drawable.img)
.into(imageviewId);
}
catch (MalformedURLException e) {
e.printStackTrace();
}
id is your socialid/facebook id
in short we just need to remove &height=320&width=420 from url.
you can compare both the url:
http://graph.facebook.com/11111111111/picture?type=large&height=320&width=420
https://graph.facebook.com/11111111111/picture?type=large
and yes you need to change http to https as well
Though I didn't find any official announcements, Facebook during last few days changed their api's, now when you request user's public profile the picture url has extra parameters, ext and hash
Calling the url without these params returns 404 error.
Not sure if the change is affecting Page Scope ID's only.
Currently, when you request user's public profile data the url looks like this
https://lookaside.facebook.com/platform/profilepic/?psid=PAGE_SCOPED_ID&height=1024&ext=1522585606&hash=AeThc8c7EQDFgShs
before it was just
https://lookaside.facebook.com/platform/profilepic/?psid=PAGE_SCOPED_ID&height=1024
It seems to me the only known solution currently would be requesting new public profile data and updating your database.
Hope that helps.

Opening Facebook event pages in the Facebook app using Swift

I am having a problem getting Facebook events in the Facebook app. For example, to open an event with the url "https://www.facebook.com/events/1743847059178738/," I would use the following code:
let facebookURL = NSURL(string: "fb://event/1743847059178738")!
if UIApplication.sharedApplication().canOpenURL(facebookURL) {
UIApplication.sharedApplication().openURL(facebookURL)
} else {
UIApplication.sharedApplication().openURL(NSURL(string: "https://www.facebook.com/events/1743847059178738")!)
}
}
It will open the Facebook app, but no matter what event I attempt to display I get a screen saying "Unable to load event. It may have been cancelled." I have tried substituting the Facebook URL of an event for that of a profile (e.g., string: "fb://profile/100005906912309") and it works just fine. Am I mistaken in assuming that the numbers at the end of the event's URL are the same as the event's numeric ID?
So I figured out that I could bypass the whole "fb://event..." bit and just go with:
UIApplication.sharedApplication().openURL(NSURL(string: "https://www.facebook.com/events/1743847059178738")!)
I assumed this would open the link in Safari, but it automatically opened in Facebook in iOS 8.
I'm sorry for the late answer. I'd prefer to write this as comment, but I'm not able to.
First, nice work around. I think it is a perfect fallback if the fb:// scheme fails as it shown in code shared with your question. I've spent a lot of time trying to resolve the same issue. What I've found is that fb://event/{event-id} is no longer supported and it was replaced with fb://event?id={event-id}.
I've used this post as a reference.

android facebook login button does not work

I'm following this tutorial "Facebook Login Flow for Android" (https://developers.facebook.com/docs/howtos/androidsdk/3.0/login-with-facebook/) to create a simple app containing only one facebook login button to test facebook login.
However, I've been having trouble logging in facebook with this button.... I've been following every step in this tutorial and I've double checked everything -- it is exactly the same as in this tutorial. I see other people who have similar problems are always because of incorrect debug hash code. But I've checked like a million times that I got the correct debug hash code. Some people say that if you wanna release an app, you need a release code. However, I'm not releasing my app -- I'm just testing it on an android device, so I guess I dont really need a release code to do that?
Also, I've checked that I've included my facebook application id for this app in the Android Manifest. So basically, everything I did was strictly following the tutorials on Facebook Developers.
I've seen some people suggesting to use the "keytool" in JDK 6 in stead of JDK 7. And I've checked that I actually did generate my debug hash code with the "keytool" in JDK 6.
So I've tried everything, but the problem still exists!
In that Android Tutorial, it suggests putting this in your code so that you can monitor your LogCat to see if your current state is logged in or logged out:
private void onSessionStateChange(Session session, SessionState state, Exception exception) {
if (state.isOpened()) {
Log.i(TAG, "Logged in...");
} else if (state.isClosed()) {
Log.i(TAG, "Logged out...");
}
}
In my case, no matter how many times I clicked Facebook Login Button, I always got "Logged out..." in my LogCat.
Also, the funny thing is, I can't even log in facebook using those sample apps coming with Facebook Android SDK 3.0.1 (eg. SessonLoginSample)!!!!! When I click the login button in those sample apps, nothing happens -- which means I'm not successfully logged in.
I really hope you guys out there can help me with this problem. It's weird I don't see other people with the exact same problem (as I said, those with similar problems are always because of incorrect debug code, but I've checked mine, it is 100% correct). THANK YOU SO MUCH!
It happened to me once. You might have added the export key hash in facebook developer setting.
Add these lines to your code to get your debugging key hash and then add to facebook.
for (Signature signature : info.signatures) {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
}

AgileToolkit OAuth add-on error 500 at facebook's mobile site

I am using the OAuth Facebook controller add-on for ATK4.
It works as expected when authenticating with Facebook from a regular desktop browser.
It works when authenticating using a mobile browser that is telling face book that it's a desktop browser.
It does not work when Facebook detects a mobile browser and redirects to m.facebook.com/dialog/oath.
What's more, is that it works fine for signups from mobile browsers (ie, when Facebook asks the user to give permission to the app).
The login flow stops with an Error 500 at:
https://m.facebook.com/dialog/oauth?redirect_uri={my_url_encoded_landing_page_where_the_OAuth_controller_lives}&scope=email&client_id={fb_app_id}
What the hell is going on here? There isn't some difference between the Facebook mobile service and the regular one that the addon isn't taking care of, or is there?
It must be something I'm doing wrong. In init() on the page that handles the FB, I am doing the following:
function init(){
parent::init();
$f = $this->add("oauth/Controller_OAuth_Facebook", array('sign_method'=>'PLAINTEXT'));
if ($fbtoken = $f->check()) {
$f->setSignatureInfo();
$f->setAuthToken($fbtoken["access_token"], $fbtoken["expires"]);
$s = $this->add("sni/Controller_SNI_Facebook");
$s->setOAuth($f);
// ...
// grab profile from SNI, database lookup, session stuff, etc
// ...
}
}
I've tried all three sign_methods, and tried leaving it alone, but that doesn't make much difference because the user is not making it back to the controller with an access token to use anyway.
I tried creating a new app with Facebook and I get the same issues with a basically vanilla configuration on that. I've only marked and specified the "Website with Facebook Login" site URL integration.
The image below was captured from Chrome after overriding the user agent to a mobile device to trigger the forward to facebook's mobile servers:
Screen shot of request
Facebook closed my bug report with them stating that it's not an issue since no one else is reporting the bug. I am removing the ATK4 tag, as I get the same issue using the example PHP code provided by Facebook on GIT.
Created dedicated example here:
http://demo.ambienttech.lv/d.html?ns=d3
Example is downloadable and includes instructions of setting up facebook app as well. See if that helps.
Try This:
<?php
class page_fb extends Page {
function init(){
parent::init();
$f = $this->add("oauth/Controller_OAuth_Facebook");
$fbtoken = $this->api->recall("fbtoken");
if ($m = $_GET["error_msg"]){
$v=$this->add("View_Error");
$v->add("Text")->setHTML("You can't connect to the application.");
$v->add("Button")->setHTML("Try again")->js("click", $this->js()->univ()->location("fb"));
return;
}
if (!$fbtoken){
if ($fbtoken = $f->check("email")){
$this->api->memorize("fbtoken", $fbtoken);
$this->api->redirect($this->api->url("/index"));
}
} else {
$f->setSignatureInfo();
$f->setAuthToken($fbtoken["access_token"], $fbtoken["expires"]);
$c = $this->add("sni/Controller_SNI_Facebook");
$c->setOAuth($f);
if (!$this->api->recall("fbuserinfo")){
$this->api->memorize("fbuserinfo", $c->getUserProfile());
}
$info = $this->api->recall("fbuserinfo");
$username = $info->username;
$img = $c->customRequest("/" . $username . "/picture?type=large");
$this->api->memorize("userimg", $img);
$this->api->memorize("userinfo", $info);
if (!$this->api->auth->isLoggedIn()){
$this->api->auth->login($info->email);
}
$this->api->redirect($this->api->url("/index"));
}
}
}
I've got the same problem, but using PHP: just using a mobile web browser is not working, giving '500 internal server error'.
I'm just asking myself if exists a parameter for the method getLoginUrl to force return a non-mobile version of the authentication page...
I reported this issue here: https://github.com/atk4/atk4-addons/issues/35
Please stay tuned and if you can, you can always make changes yourself and pull request.
I can't test and fix this because strangely I still don't have smart phone :(
Something changed in FB's mobile OAuth service that is causing the error. I ran a test with my code base on a shorter URL (ie; http://domain.net/fb/ rather than http://development.project.domain.net/fb) and it works fine. I am not entirely sure of what exactly is causing the problem as Facebook refuses to acknowledge the issue as being on their server, but I have a few possible culprits that may be triggering the error on their side, but since they don't care, I don't either, and I am providing my results for anyone else who encounters this bs.
The environment I am developing in uses semi-complex (apparently) naming scheme. The development server has its own hostname under a subdomain. The issue may be caused by the fact that there are multiple components to the host portion of the URL or simply too many characters.
The name servers for the development environment are provided by DynDNS. Facebook's mobile OAuth service may be choking on the idea of a development site being hosted on a non-permanent IP address.
I'm not going to do anymore testing on this because it really is a problem with Facebook, not my code or servers, and it will work in production.