Instafeed access token authentication issue - instafeedjs

I am trying to get instafeed from http://instafeedjs.com/. I am using following code:
<script type="text/javascript">
var feed = new Instafeed({
get: 'tagged',
tagName: 'awesome',
clientId: 'YOUR_CLIENT_ID'
});
feed.run();
</script>
But when debugging with firebug, its giving error: "Uncaught Error: Error from Instagram: The access_token provided is invalid."

This issue is resolved by following script:
<script type="text/javascript">
var userFeed = new Instafeed({
get: 'user',
userId: 'xxxxx',
accessToken: 'cccccccccc'
});
userFeed.run();
</script>

Related

Integration between Axios and RequireJS fail

I have a error in integration between RequireJS and Axios:
<HEAD>
<script src="3party/require.js"></script>
<SCRIPT>
//work!
requirejs(['/bower_components/jquery/dist/jquery'],()=>{
console.debug($);
})
//error
requirejs(['/bower_components/axios/dist/axios'],()=>{
axios.get('https://httpbin.org/get').then(function(response){
console.log(response.status); // ex.: 200
});
});
</SCRIPT>
</HEAD
The URL is a test service, the error below occurs.
require.js:5 Uncaught Error: Script error for "/bower_components/axios/dist/axios"
https://requirejs.org/docs/errors.html#scripterror
at makeError (require.js:5)
Any URL, or even the below line, the error occurs:
console.debug(axios);
I am using the below version:
"axios": "^0.19.2",
I've checked the AXIOS code and it does support AMD. So you need to use it as a regular AMD:
<HEAD>
<script src="3party/require.js"></script>
<SCRIPT>
requirejs(['/bower_components/jquery/dist/jquery'],()=>{
console.debug($);
})
requirejs(['/bower_components/axios/dist/axios'],(axios)=>{ // axios is given as a argument to a your callback
axios.get('https://httpbin.org/get').then(function(response){
console.log(response.status); // ex.: 200
});
});
</SCRIPT>
</HEAD>
AXIOS will not be available as global but as a local module when you require it :)

How to get all survey answer by current user with REST Api Sharepoint?

In sharepoint survey API:
Get all question: https://site/_api/Web/Lists/getByTitle('Survey')/fields?$filter=(CanBeDeleted eq true)
Get all answer: https://site/_api/Web/Lists/getByTitle('Recognition%20Awards%202019')/items
Get all answer by current user login: ???
Please help me.
We can use _spPageContextInfo.userId to get the current login user Id, then using $filter=AuthorId eq UserId to get all the answer by current user login.
<script src="https://code.jquery.com/jquery-1.12.4.min.js" type="text/javascript"></script>
<script type="text/javascript">
function getItems() {
var listTitle="Recognition Awards 2019";
var currentUserId=_spPageContextInfo.userId;
$.ajax({
url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getbytitle('"+listTitle+"')/items?$filter=AuthorId eq "+currentUserId,
type: "GET",
headers: { "ACCEPT": "application/json;odata=verbose" },
success: function (data) {
//
},
error: function (err) {
//alert(err);
}
});
}
</script>
<input id="Button1" type="button" value="Get Items" onclick="getItems()" />

instafeedjs doesn't work on my site

I'm trying to set up instafeedjs but it doesn't work.
script type="text/javascript" src="/instafeed.min.js"></script>
<script>
var feed = new Instafeed({
clientId: '377e47596dcf4fc284d36fe0098700ba',
useHttp: true
});
feed.run();
</script>
Please make sue the, you have done the following steps in your code.
Added a div tag with id "instafeed"
Mapped the instafeed.js library correctly.
Refer the code blog below for more info.
var feed = new Instafeed({
clientId: '377e47596dcf4fc284d36fe0098700ba',
useHttp: true
});
feed.run();
<script src="http://sriajith.info/wp-content/uploads/2015/05/instafeed.min_.js"></script>
<div id="instafeed"/>

Adding a post-purchasing share following an order

I'm attempting to add a 'Share your order with your friends' option to our retail based website, and am following the faq based here: https://www.facebook.com/help/?faq=201527026558981
I have managed to manipulate the code as I think is correct, however in the FAQ answers the setup on the App is vague at best.
When testing in dev (on localhost) I'm receiving the following error:
API Error Code: 191
API Error Description: The specified URL is not owned by the application
Error Message: redirect_uri is not owned by the application.
In the basic settings of the app I have no idea what settings need entering around the auth domain, site url, canvas url etc - I'm new to the facebook dev side of things. As far as I can tell I shouldnt need a site URL, as am not using facebook login. Does the canvas URL need to be populated, and if so, does that mean I then need to create a new page for the content of this app?
The code I'm running is:
<script>
window.fbAsyncInit = function() {
FB.init({appId: '1111111111111', status: true, cookie: true,
xfbml: true});
};
(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol +
'//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
</script>
<script>
function stream_publish(publish_text) {
var publish = {
method: 'stream.publish',
message: publish_text,
attachment: {
name: 'xxxxxxxx',
description: (
'xxxxxxxxx' ),
href: 'http://www.mydomain.com',
media: [
{
type: 'image',
href: 'http://www.mydomain.com',
src: 'http://www.mdomain.com/image',
}
]
},
action_links: [
{ text: 'Buy Now', href: 'http://www.mydomain.com', }
],
user_prompt_message: 'Tell your friends'
};
FB.ui(publish);
}
</script>
Can anyone advise how this should be done and what I'm missing?
Many thanks
Piers
From the error message, you don't have mydomain.com setup in your app settings.

Feed Dialog not working on some browsers

Hi guys I have a weird problem with de feed dialog.
It works pefect on Firefox, but when I try to use it on IE or Chrome I got this error "An error occurred. Please try later"
I have tried to fix it but I can't. Can you help me please.
This is the code i'm using to call the dialog.
<div id='fb-root'></div>
<script src='http://connect.facebook.net/en_GB/all.js'></script>
<a href="#" onclick='postToFeed(); return false;'>Post Feed</a>
<script>
FB.init({appId: "xxxx", status: true, cookie: true});
function postToFeed() {
// calling the API ...
var obj = {
method: 'feed',
link: 'http://apps.facebook.com/xxxx',
picture: 'xxxx',
name: 'xxxx',
caption: 'xxxxx',
description: 'xxxxx',
properties: [{text: 'xx', href: 'xx'},],
actions: [{name: 'xx', link: 'xx'}],
};
function callback(response) {
document.getElementById('msg').innerHTML = "Well Done!!";
}
FB.ui(obj, callback);
}
</script>
</script>
A couple of things to try:
1: It could possibly be as simple as the rogue comma in your code here after actions:
actions: [{name: 'xx', link: 'xx'}],
Try removing that, however Chrome should better handle that, but that would have caused an issue with IE!
2: Use the Console to see if any errors are thrown.
3: Add oauth: true to your init statement like so:
FB.init({appId: "xxxx", status: true, cookie: true, oauth: true});
4: Remove the parameters in the call, and add them back in one by one after testing it works with each addition: start with:
var obj = {
method: 'feed',
link: 'http://apps.facebook.com/xxxx',
picture: 'xxxx',
name: 'xxxx',
caption: 'xxxxx',
description: 'xxxxx'
};