Closed jamesmacwhite closed 8 months ago
For info. If I interrupt the auth flow and get the code
value before getShortAccessToken()
runs so it doesn't get used and did a manual HTTP POST request outlined on: https://developers.facebook.com/docs/instagram-basic-display-api/guides/getting-access-tokens-and-permissions/#step-2--exchange-the-code-for-a-token. It appears to work fine.
{
"access_token": "[redacted]",
"user_id": "[redacted]"
}
I was able to paste the access_token
provided in the response into Craft and this works.
Right so the environment variable was wrong for the Instagram client secret! Doh. However, I had to create a new Facebook App, as the one that was used previously had the Facebook Login product added to it accidentally and you cannot remove products (right....) which may have cause issues with the app setup and broke it originally. Creating a new app was the solution, but only when you provide the correct details!
The OAuth error is somewhat not related to the actual problem, but in this case the client_secret was wrong!
I have previously been able to authorise the connection a few months ago, but now cannot seem to authorise a token for use with the Instagram API. We had a refresh cron job running, but it appears the token had expired.
Debugging locally, there appears to be an OAuth error:
One of the redirect URIs saved in the Client OAuth settings is:
https://nottingham-college.ddev.site/actions/craftagram/default/auth
Instagram authorize URL (before clicking allow):
The URL in the browser after this, when the error occurs.
I did notice the inclusion of
#_
at the end of the URL, and tried to add an OAuth redirect URL with this after the auth path but that didn't solve it.There was a recent Facebook/Instagram outage recently, I don't know if anything has changed or cause problems?
As far as I know the application setup should be correct based on the instructions and double checking the redirect URIs set do match.
Craft CMS: 3.9.10 Pro Craftagram: 1.4.6