Частичное отключениеshare-external
How to Resolve 'Unsupported Request - Method Type: GET' Error with Instagram Graph API for Specific Users?
2

Here’s the translation and rephrasing:


Hello,
I'm experiencing an issue with the Graph API, which is returning this error message for certain users only:

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

Here’s the context:
I'm working on a NextJS application where I log in via Instagram. I successfully retrieve the access token using this request:

const formData = new FormData();
formData.append('client_id', process.env.INSTAGRAM_CLIENT_ID ?? '');
formData.append('client_secret', process.env.INSTAGRAM_CLIENT_SECRET ?? '');
formData.append('grant_type', 'authorization_code');
formData.append('redirect_uri', INSTAGRAM_REDIRECT_URI ?? '');
formData.append('code', code);

const res = await fetch('https://api.instagram.com/oauth/access_token', {
    method: 'POST',
    body: formData,
});
const data: { access_token: string, user_id: string, permissions: string } = await res.json();

Then, I send the token to the Graph API like this:

const instagramData = await fetch(`https://graph.instagram.com/v21.0/me?fields=followers_count,username&access_token=${data.access_token}`);
const instagramDataJson: { followers_count: string, username: string } = await instagramData.json();

For some users, this successfully returns followers_count and username, but for others, I receive:

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

I confirm that I have advanced access to instagram_business_basic permissions. Do you have any suggestions on how to resolve this issue? Thank you in advance.

Ilane
Вопрос задан около 2 нед. назад