问题
I'm quite new using instagram API/Graph API but I can't find answers to my questions.
Since Instagram API is deprecated, now we have to deal with instagram/facebook graph API.
I am aware of the new procedure (https://developers.facebook.com/docs/instagram-api/getting-started/ ) that consist of:
- Connect a Facebook Page to an Instagram Business Account.
- Register your app.
- Add the Facebook Login product.
- Add the Instagram API product.
- Test your app's settings with the Graph API Explorer.
- Submit your app for App Review.
The problem is that I only want to be able to get my own instagram feed only.
But by default, the minimum API permission is instagram_basic This permission must be reviewed by facebook before beeing granted.
And to be reviewed we must provide (as a screencast):
- How a business will log in with Facebook to connect their Instagram profile
- How a business will see this feature used in your app
As described here
But for my use case I don't have such things to show as I just want to do backend processing for my own feed.
My questions are:
- Does the graph API allow this?
- Do I miss something, like a kind of App token for instagram ? (Like : https://developers.facebook.com/docs/facebook-login/access-tokens?locale=en_US#apptokens)
- Is there a workaround ?
Thanks for your time and contribution.
回答1:
If you are the page owner and the developer of the app, it should work without review.
回答2:
Facebook reviews are pretty annoying and mostly impossible to go through. But I managed to make exactly what you want: get my own Instagram's feed. I made it with Facebook Javascript SDK.
The first thing you should keep in mind is that you must be logged in your Facebook's account with the browser you are using. Otherwise, you should add the login code (I can put in here if you need it).
After all the steps about connect your Facebook account with your Instagram (getting the appID):
Reference Facebook Javascript SDK
<script async src="https://connect.facebook.net/es_ES/sdk.js"></script>
Init Facebook
FB.init({
appId: "your_app_id",
autoLogAppEvents: true,
xfbml: true,
version: "v3.1"
});
If you are connected (very important):
FB.getLoginStatus(function (response) { // Check login status
if (response.status === "connected") {
FB.api(
"/" + your_facebook_page_id + "/",
"GET", { "fields": "instagram_business_account" }, // Get Instagram's account ID
function (response) {
FB.api(
"/" + response.instagram_business_account.id + "/media", // Get Instagram's media
"GET", { "fields": "shortcode" }, // In this case, only shortcode
function (response) {
// Do something with the data
}
);
}
);
} else {
console.log("Error recovering access token: Not connected.")
console.log(response)
}
});
Hope it helps!
来源:https://stackoverflow.com/questions/50365510/get-instagram-own-self-feed-with-facebook-graph-api