Posts tagged with instagram-graph-api

I'm currently migrating an app that uses the Instagram Basic Display API (api.instagram.com) to the Instagram Graph API (graph.instagram.com), as the Basic Display API will be deprecated on December 4th, 2024.

I’ve read in the official documentation that I need to create a new app of type "Business" in Meta for Developers and request the instagram_business_basic scope to perform the same actions as before.

Current Implementation

For token generation and API calls, my current workflow looks like this:

1. Short-Lived Access Token Generation

// Short-lived token $url = "https://api.instagram.com/oauth/access_token"; $fields = array(   'client_id' => MY_APP_ID,   'client_secret' => MY_APP_SECRET,   'grant_type' => 'authorization_code',   'redirect_uri' => MY_REDIRECT_URI,   'code' => $code ); return call_curl("POST", $url, $fields); 

2. Long-Lived Access Token Exchange

// Long-lived token $url = "https://graph.instagram.com/access_token?grant_type=ig_exchange_token&client_secret=" . MY_APP_SECRET . "&access_token={$token}"; return call_curl("GET", $url); 

3. API Calls

$data = fetchData("https://graph.instagram.com/me/media?fields={$fields}&access_token={$tokenInstagram}"); 

My Concerns

  • The short-lived token generation process appears to still use the endpoint https://api.instagram.com/oauth/access_token. Is this endpoint going to stop working after the Basic Display API deprecation?
  • Although I’ve switched to the Instagram Graph API for token exchange (graph.instagram.com/access_token) and data fetching, I’m worried that the short-lived token endpoint dependency will cause issues post-deprecation.
  • The Graph API Explorer doesn’t list the graph.instagram.com endpoint, and most references online seem to use graph.facebook.com. Should I be using graph.facebook.com instead for Instagram-related API calls?

What I’ve Done So Far

  • I’ve created a new Business-type app in Meta for Developers.
  • I’ve configured the app with the necessary Instagram permissions.
  • The app has been reviewed and approved by Meta.
  • I’ve verified the generated tokens using the Token Debugger tool, and they are associated with the correct Business app.

My Question

Despite these steps, I’m still unsure if my implementation is fully future-proof for the Instagram Graph API.

  1. Am I missing any critical steps or considerations here?
  2. Should I be worried about the short-lived token generation endpoint?
  3. Why isn’t graph.instagram.com listed in the Graph API Explorer, and should I switch to graph.facebook.com for Instagram API calls?

Any guidance or clarification would be greatly appreciated!

My app is registered on facebook and has been live since the past 2 years. Now, i switched it to development mode since i need to integrate with "Instagram API with Facebook login".

So after following the documentation, https://developers.facebook.com/docs/instagram-platform/instagram-api-with-facebook-login/business-login-for-instagram , i linked my insta business account to one of my facebook pages using this link https://www.facebook.com/business/help/connect-instagram-to-page (Note : My facebook account has 2 pages)

I also linked the fb account to insta account by following this : https://help.instagram.com/176235449218188

I have added instagram under products section in my registered app in facebook. I have not confgured anything with respect to "API Setup with facebook login" there.

Now, iam trying to access /me/accounts to get all the pages data and instagram business account id by including scopes "instagram_basic" and "instagram_content_publish"

But iam not getting any data in graph API tool. It just returns

{   "data": [   ] } 

I have tried to debug, but couldnt figure it out. Iam stuck at this point. Any help would be appreciated,thanks.

i got the access token but while exhangeing it for long live token api getting following error

error: { message: 'Unsupported request - method type: get', type: 'IGApiException', code: 100, fbtrace_id: 'AnMYrIXYSTKYCA_Sh2qKxkU' }

const accessTokenApi = {             url: 'https://api.instagram.com/oauth/access_token',             method: 'post',             headers: {                 'Content-Type': 'application/x-www-form-urlencoded'             },             body: new URLSearchParams({                 code: code,                 redirect_uri: instagramConfig.callbackUrl,                 client_id: instagramConfig.clientId,                 client_secret: instagramConfig.clientSecret,                 grant_type: 'authorization_code',             }).toString(),         };         const tokenResponse = await this.apiCall(accessTokenApi); const userPlatform = await this.userPlatformService.getUserPlatfromsByCode(userId, "INSTAGRAM");         const userLongLiveTokenApi = {             url:`https://graph.instagram.com/access_token?grant_type=ig_exchange_token&client_secret=${instagramConfig.clientSecret}&access_token=${userPlatform.authToken}`,             method: 'get',             headers:{}         }         console.log(userLongLiveTokenApi)         const userLongLiveTokenResponse = await this.apiCall(userLongLiveTokenApi);