0

I'm trying to utizlie Insatgram Basic Display API to get some information about particular Instagram post. I'm going through Facebook API documentation, but there are some inconsistencies I can't seem to find solution to. My goal is to create a private app I can use on my website, that would display some information about any given Instagram post (not only from my account).

I have created FB app already and used the following url to authorize it on Instagram:

https://api.instagram.com/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URL&scope=user_profile,user_media&response_type=code



This redirects me to the usual Instagram permission window, which I accept and am being redirected back to this url:

https://REDIRECT_URL?opauth=CODE#_



There are two problems from now on:
1. Facebook docs state that url parameter in return should be code, not opauth:

https://developers.facebook.com/docs/instagram-basic-display-api/guides/getting-access-tokens-and-permissions
  1. When I use value of opauth in the following CURL request, I get the Invalid Authorization Code error in return:
curl -X POST https://api.instagram.com/oauth/access_token -F "client_id=CLIENT_ID" -F "client_secret=CLIENT_SECRET" -F "grant_type=authorization_code" -F "redirect_uri=REDIRECT_URL" -F "code=OPAUTH_VALUE"



I have double checked every value in request and they seem to be correct. I went through authorization process several times just to be sure, but can't obtain access token no matter what.

Lukasz Formela
  • 447
  • 4
  • 17

1 Answers1

0

Found it. The opauth parameter was somehow a result of WordPress theme using Opauth framework. Redirected url from Instagram had value of code parameter replaced with new opauth param with it's own value.

Using different theme allowed me to get correct code parameter from redirect url and get access token.

Lukasz Formela
  • 447
  • 4
  • 17