I am using the Instagram Basic Display API OAuth flow to authenticate an Instagram account within my web application.
Once they have authenticated successfully, I am exchanging the short lived access token for a long lived one, code snippet below:
url = "https://api.instagram.com/oauth/access_token"
body = {
'client_id': CLIENT_ID,
'client_secret': CLIENT_SECRET,
'grant_type': 'authorization_code',
'redirect_uri': REDIRECT_URI,
'code': CODE
}
I have tested this for various Instagram Professional accounts. For some, I get a HTTP 200 response and I am able to get a long lived access token. But for others, I get the following response:
{
"error": {
"message": "Unsupported request - method type: get",
"type": "IGApiException",
"code": 100,
"fbtrace_id": "AtnOFqdYDJ9lDj2GgOwv7EE"
}
}
Researching on the internet this looks like a bug on Facebook's side, and that this happens somewhat randomly. Can someone please explain why this is happening and implement a fix as soon as possible? My application relies on users being able to authenticate using their Instagram Professional account and this bug is preventing critical features from working.