Facebook Javascript API unknown path components - facebook-graph-api

I'm trying to integrate Facebook sharing into a webpage using this code edited from their official developer tutorial, but I'm not having any luck.
function postToFacebook(item_id)
{
FB.api(
'/me/completeset:display',
'post',
{ item: 'http://completeset.us/item/'+item_id },
function(response) {
if (!response || response.error) {
alert('Error occured');
} else {
alert('Share was successful! Action ID: ' + response.id);
}
}); //End api
}
I've got the app set up, with an "item" object and the "defined" action defined. I haven't been able to submit the action yet though, because I haven't been able to post anything with it yet. I've verified that the item_id is being passed in correctly, and I've debugged the url using their debugging tool. When I call this function I'm getting unknown path components/ completeset:display. I haven't been able to find much information on this error, so I'm wondering: what are the causes, and how might I be able to fix it?

The names mismatched. The getCode link for the action on facebook displayed the name of the action as being show_off for some reason. It was the same problem as the linked question. I experimented with the app backend and found that if you create an action with one name and then change the name of it, it will display with the new name but you must still reference it using the old name in the code.

Related

Ember - Change current route from browser console

I am not at all Ember developer, but I would like to change current route from browser console. Is it possible at all to access correctly Ember, e.g. Ember.Router.prototype.transitionTo('/feed')?
Version of the website is 3.16.9
After a lot of research, I have found out possible solutions that you can use. I was trying to achieve it on Linkedin website via Chrome Extension
function runEmbedded(path) {
const namespaces = window.Ember.Namespace.NAMESPACES;
let application;
namespaces.forEach(function (namespace) {
if (namespace instanceof window.Ember.Application) {
application = namespace;
return false;
}
});
application.__container__.lookup('router:main').transitionTo(path);
}
const payload = '/some/new-path'
script.text = `(${runEmbedded.toString()})('${payload}');`;
document.documentElement.appendChild(script);
Second solution/hack:
Another possible hack to use, when the website is not listening to pushState/replaceState actions from History API is to push state 2 times and then go back. Please remember that's only a hack.
history.pushState({}, '', msg.payload);
history.pushState({}, '', msg.payload);
history.back();

How to implement a sign-in button of Google and Facebook in a Google AMP?

I want to create a simple "sign-in" button of Facebook and Google.
I read the documentation (https://amp.dev/documentation/examples/personalization/oauth2_login/#setup)
and look at the example in the playground section, but my problem is how do I do this part
"facebook-sign-in": "https://ampbyexample.com/oauth/login/facebook",
"google-sign-in": "https://ampbyexample.com/oauth/login/google",
in example of AMP documentation:
<script id="amp-access" type="application/json">
{
"authorization": "https://ampbyexample.com/oauth/status?_=RANDOM",
"noPingback": "true",
"login": {
"facebook-sign-in":"https://ampbyexample.com/oauth/login/facebook",
"google-sign-in":"https://ampbyexample.com/oauth/login/google",
"github-sign-in":"https://ampbyexample.com/oauth/login/github",
"sign-out":"https://ampbyexample.com/oauth/logout"
},
"authorizationFallbackResponse": {
"error": true,
"loggedIn": false
}
}
</script>
What do I do inside of this file https://ampbyexample.com/oauth/login/facebook in my application? what do I need to do it? I'm so confused about this part.
EDIT
I found this example but how make this logic with facebook without open a new pop up inside of amp's popup? (https://developers.facebook.com/docs/facebook-login/web) about this example, my login button just stay inside of amp popup... but my expected result is like this example here
Sign-in with amp-access will always open a new popup. This is to ensure that it's always possible to write first party cookies on your own origin, even if the AMP pages is served from an AMP cache.

A way to test if https://www.google.com/jsapi available within intranet

I am working on an intranet application that uses the Google Visualization API to produce charts.
My question is is there a way to determine if access to https://www.google.com/jsapi server is down or blocked due to the company use of iPrism and display that information simply to the user on the page.
I know iPrism dosn't block it on my machine but i'm not sure about the client machines or that it may change in the future.
Any help is aapreciated.
I don't think there is anything you can trigger of of a script tag failing to load, but you could try to catch the failure before calling google.load, maybe with something like this?
if (typeof(google) == 'object' && typeof(google.load) == 'function') {
google.load('visualization', '1', {packages:['corechart'], callback: drawChart});
}
else {
// display error message about failing to load jsapi
}

Posting to a wall on Facebook for a fan page

Using the current PHPSDK and API (ie not FBJS or the REST approach) I am trying to work out how to paste to a fanpage wall and struggling to find any hints...
I have successfully (through various attempts)
posted to my wall
posted to a friend's wall
posted to the page's wall (when I like the page before posting)
posted to the page's wall (as the page)
So I am looking to work out what I need to do to access_code/permissions or code to have something like :
$result = $facebook->api(
'/<PAGEID>/feed/',
'post',
array('access_token' => <ACCESSCODE>, 'message' => 'Test message')
);
or
FB.api('/<PAGEID>/feed', 'post', {access_token:<ACCESSCODE>, message:'Test message'},
function(response) {
if (!response || response.error) {
alert(response.error.message);
} else {
}
});
working where a post will appear on the feed of page's wall... However I am currently unable to find a way to post to a page wall for a page that I have not explicitly said I like by using the Graph API in PHP...
I am sure it is possible judging by some of the page walls I have seen.
Searching on google and forums tends to lead to old API implementations (which no longer function) or using methods no longer supported. It seemed that the Templatized function could have been what I was looking for (but again that has been deprecated).
What am I doing wrong?
You have to have one of the page administrators give your app "publish_stream" permission. Something like this:
$session = $facebook->getSession();
$perms = 'publish_stream';
echo '<fb:login-button perms="' . $perms . '"></fb:login-button>';
Once the click the button and approve you, your callback url will get called with their session information.
Once you have that you can post to the wall of any page they administer. Using code like what you show in your question.

Trouble Getting Data from a Webservice using Qooxdoo

My capstone team has decided to use Qooxdoo as the front end for our project. We're developing apps for OpenFlow controllers using NOX, so we're using the NOX webservices framework. I'm having trouble getting data from the service; I know the service is running because if I go to the URL using Firefox the right data shows up. Here's the relevant portion of my code:
var req = new qx.io.remote.Request("http://localhost/ws.v1/hello/world",
"GET", "text/plain");
req.addListener("complete", function(e) {
this.debug(e.getContent());
});
var get = new qx.ui.form.Button("get");
get.addListener("execute", function() {
alert("The button has been pressed");
req.send();
}, this);
form.addButton(get);
In the firebug console I get this message after I click through the alert:
008402 qx.io.remote.Exchange: Unknown status code: 0 (4)
And if I press the Get button again I get this error:
027033 qx.io.remote.transport.XmlHttp[56]: Failed with exception: [Exception... "Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIXMLHttpRequest.open]" nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)" location: "JS frame :: file:///home/user/qooxdoo-1.0-sdk/framework/source/class/qx/io/remote/transport/XmlHttp.js :: anonymous :: line 279" data: no]
I've also looked at the Twitter Client tutorial, however the "dataChange" event I set up in place of the "tweetsChanged" event never fired. Any help is appreciated, thank you.
This sound like a cross domain request issue. qx.io.remote.Request uses XHR for transporting the data which may not work in every case due to the browser restriction. Switching the crossDomain flag on the request to true will change from XHR to a dynamically inserted script tag doesn't have the cross domain restriction (but other restrictions).
req.setCrossDomain(true);
Maybe that solves your problem.
Additionally, you can take a look at the documentation of the remote package to get some further details on cross domain requests:
http://demo.qooxdoo.org/current/apiviewer/#qx.io.remote
Also take care not to use a request object twice. The only work once.