Why does the facebook debugger redirects? - facebook

I have a "http" (developer) page, which is enabled for the facebook, its visible from the outside. When I want to debug it with https://developers.facebook.com/, it shows everything OK:
Response Code: 200
Fetched URL: http://my.dev.com/id/3161304
Canonical URL: http://my.dev.com/id/3161304/
Redirect Path:
Input URL -> http://my.dev.com/id/3161304
301 HTTP Redirect -> http://my.dev.com/id/3161304/
I have this site cloned, for testing, https-ed. The result is different:
first, some parameters are missing:
Missing Properties
The following required properties are missing: og:url, og:type, og:title, og:image, og:description
Secondly, the response:
Response Code: 200
Fetched URL: https://my.cloned.site.com/id/3161304/
Canonical URL: https://my.cloned.site.com/id/
Redirect Path
Input URL: -> https://my.cloned.site.com/id/3161304/
rel="canonical" Meta Tag -> https://my.cloned.site.com/id/
it seems that a redirect happens. Why?

Related

Google Form Link Can't be accessed (/formResponse)

First of all, sorry asking this question cause it's not about current topic
It's just about google form link that my expectation is I could open url with /formResponse
(Website Behaviour)
Request: When I try enter the link https://docs.google.com/forms/d/1WyFssMa_l1e_es9zSMJsojnqTA2AahmpfWiWknXr_P8/formResponse
Response: it will redirected to https://docs.google.com/forms/d/1WyFssMa_l1e_es9zSMJsojnqTA2AahmpfWiWknXr_P8/viewform
(HTTP Post Behaviour)
Request: (POST to https://docs.google.com/forms/d/1WyFssMa_l1e_es9zSMJsojnqTA2AahmpfWiWknXr_P8/formResponse)
Response: get an error like this:
Sorry, the file you have requested does not exist.
Anyone can help how to solve this? I appreciate if you get me out of this issue
I solved it when I used fetch from JavaScript
const opts = {
method: "POST",
mode: "no-cors",
redirect: "follow",
referrer: "no-referrer",
body: formData
}
fetch(url, opts)
...

After successful login page not found 404 encountered, when setting 'pageNotFound_handling' TYPO3 7.6 version

If my successful login redirected url is like
domain.com/abc/xyz
where
abc = my page name
xyz = my action name of my custom extension
404 = 404 page name
When I set 404 page as below;
$GLOBALS['TYPO3_CONF_VARS']['FE']['pageNotFound_handling'] = 404
Then after successful login its redirected to 404 error page, it should redirect as earlier ie. domain.com/abc/xyz not 404 page
It's redirects to 404 page, because may be your url domain.com/abc/xyz is not found on your domain.
You can select After Successful Login Redirect to Page option in login form plugin with page abc and your custom extension plugin is used on this page(abc).

Facebook graph api like an external url, statistics

I am using a Facebook graph api to like an external url:
Method: POST
URL:
https://graph.facebook.com/v2.1/{userId}/og.likes
Header:
application/x-www-form-urlencoded
Body:
access_token={appId}|{appSecrect}&object={"url":"{myUrl}", "title":"{myTitle}"}
It is publishing successfully, returning an Action Id.
I have 2 problems:
I can keep liking with the same user Id and it will always succeed.
I can find my url in object_url table, but link_stat and url_like do not contain any information about this url.
Another strange thing, is if I publish my url like this:
access_token={appId}|{appSecrect}&object={myUrl}
The first request throws an error "title is missing".
The second time the same request returns success.
After that for the same requests it is able to distinguish that a user already liked the url. And I have information in link_stat table.
I finally found the solution.
1. Create an object
This request creates an object "link" and returns an Object Id.
URL: /app/objects/website
Header: Content-Type: application/x-www-form-urlencoded
Body: UrlEncode object's json!
access_token={appId}|{appSecret}&object={
"title":"Happy event",
"image":"{img_url}",
"url":"{custom_url}",
"description":"{description}",
"data": {} }
You can read more here:
https://developers.facebook.com/docs/opengraph/using-objects
2. Like an object
This request will "like" your link on behalf of the user.
It will show in the user's timeline as "User likes a link on you Application site..".
Make sure:
1. User has granted "publish_actions" permission;
2. Your application is apprved for submission of the likes. Otherwise only administrators, developers and testers of you Application can make "likes".
For more information read this :
https://developers.facebook.com/docs/opengraph/submission-process
URL: /v2.1/{user_id}/og.likes
Header: Content-Type:application/x-www-form-urlencoded
Body: object={object_id}&access_token={appId}|{appSecret}
3. Get likes for an object
URL: /v2.1/{object_id}/likes?access_token={appId}|{appSecret}

Facebook profile pic URL redirect to different URL

I am using Faceboook API to login into my website through FB.
In this when I try to fetch the profile photo of the logged-in user through URL "http://graph.facebook.com/100003373201743/picture". Didn't get the response in code.
*id of user fetched from FB # run time.
Found the reason as well, coz defined URL redirects to "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-frc3/t1.0-1/p50x50/1975108_483512481771188_559759638979699650_s.jpg". I am not finding any link between these two URLs. So that I can directly hit to redirected one URL.
You can directly use the image url as "http://graph.facebook.com/100003373201743/picture", as #Tobi has mentioned
or,
if you want to fetch the actual url, you can get that in response of this-
http://graph.facebook.com/100003373201743/picture?redirect=0
You'll get the response as-
{
data: {
url: "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-frc3/t1.0-1/p50x50/1975108_483512481771188_559759638979699650_s.jpg",
is_silhouette: false
}
}
I found the solution of this problem.
Fetching headers of the URL "http://graph.facebook.com/100003373201743/picture".
Header named as "Location" have the value of redirected URL like "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-frc3/t1.0-1/p50x50/1975108_483512481771188_559759638979699650_s.jpg"
So hitting this URL and its working fine.

Facebook Send dialog with API Error code: 100 ('link' is invalid)

I want to provide users with the ability to send money to their Facebook friends through our app (Exvo) by the means of sending an URL to the invitation page via Facebook.
I'm using the 'Send' Facebook dialog (with a redirect to the Facebook webiste). The exact url I'm redirecting the user to is (to field has been redacted):
https://www.facebook.com/dialog/send?app_id=637466739616439&description=You+can+create+an+Exvo+Account+to+accept+this+money+transfer.&display=page&link=https%3A%2F%2Fwww.exvo.com%2Finvitations%2F9fb77bda665f0ae8f58843daec80a29b&name=Pawe%C5%82+Go%C5%9Bcicki+would+like+to+send+you+0.01+EUR&picture=https%3A%2F%2Fthemes.exvo.com%2Fstylesheets%2Fimages%2Fcustom_images%2Flogo.png&redirect_uri=https%3A%2F%2Fwww.exvo.com&to=username
This present me with a Facebook 'Send' dialog. When I type a custom message and press 'Send', I'm presented with this error:
API Error Code: 100
API Error Description: Invalid parameter
Error Message: 'link' is invalid.
The link param (extracted from the above URL and decoded) is this:
https://www.exvo.com/invitations/9fb77bda665f0ae8f58843daec80a29b
which is a valid URL, returning a proper 200 response. Using the Facebook debugger I can see that the provided URL does not generate any errors:
https://developers.facebook.com/tools/debug/og/object?q=https%3A%2F%2Fwww.exvo.com%2Finvitations%2F9fb77bda665f0ae8f58843daec80a29b
Only warnings about inferred properties (I have added those at one point as well, but it did not help).
Also note, that once in a while (like 1 in 10), when I click 'Send', the message gets through and I don't see any errors, which makes it even weirder.
Why is this error happening? What am I doing wrong?
This might not have been the problem in your case, but just for discoverability: make sure that the URL you are sharing is publicly available on the internet (i.e. not within your firewall or on a local computer). FB needs to visit your URL to verify its authenticity.
Like mpcabd has pointed out above, make sure to remove anything with fb, fbdev, facebook in the url because when I did, it solved the issue for me. It is probably a bug or a security measure by Facebook. You are always required to pass a redirect_uri with the link and try mentioning a title as well.
Also your link and redirect_uri must be within your domain that you have provided for the app. Ex: if your app domain in app settings is http://stackexchange.com, you cannot share a link like say https://stackoverflow.com/apps/php/fbsdk/etc/login.php, instead you have to share the link https://stackexchange.com/apps/php/etc/login.php which has worked for me
echo "<a href='https://www.facebook.com/dialog/send?app_id=YOUR_APP_ID&name=Thanks&link=".$linkToShare."&redirect_uri=".$linkToRedirectTo."'/>Send</a>";
You can also assign $title to something.
I figured out something weird, the same thing happened today on the site I manage, the problem seemed to be that the link contains the word facebook in it, so try to remove [facebook, fb, or f if it was a whole word] from your url, it should work, I had a url like open/ID/facebook/ and the only way it worked when I changed it to fopen/ID/ which looks stupid!
So may be in your case this is the problem:
https://www.exvo.com/invitations/9fb77bda665f0ae8f58843daec80a29b
Try to change your url to something without fb or facebook or anything similar.
I had this issue using the send dialog only. I was using dynamic querystring parameters on a common URL. The common URL has been scraped by Facebook but each iteration of the common URL and the querystring parameters would result in this error if Facebook had not scraped that exact URL previously.
I fixed the issue by forcing Facebook to scrape the URL before I attempt to send it via the FB UI Send Dialog. Use the FB API to hit graph.facebook.com with the URL posted in the id parameter and a scrape parameter set to true.
Like so:
FB.api('https://graph.facebook.com/', 'post', {
id: '[URL]',
scrape: true
}, function(response) {
FB.ui({
method: 'send',
name: '[name]',
picture: '[Picture URL]',
link: '[URL]',
description: '[description]'
});
});
I also answered with this solution to the same problem here.
Doing the following fixed it for me:
shorter token (this string in the link param: 9fb77bda665f0ae8f58843daec80a29b, which was 32 characters long, now is at 16) as advised by gkimsal
accepting October 2013 breaking changes, which required me to introduce OpenGraph tags to the page and drop name, description and picture_uri params that I was including when constructing the Send dialog redirect uri
Now Facebook, before displaying the Send dialog to the user, must fetch my page beforehand to retrieve the data (from OG: title, description and image) required to display a proper dialog to the user. I think this is what helped the most in my case.