Closed ynamite closed 4 years ago
Wow, after spending several days on the issue, finally posting this issue, merely 40 minutes later I found the solution.
For anyone running into similar issues, in my case the problem was http_build_query
in conjunction with the fact that both web servers had the following php.ini setting set:
arg_separator.output = "&"
the default setting is:
arg_separator.output = "&"
To solve the issue, either change http_build_query to use & instead of & like so:
http_build_query($yourParams, null, '&');
or simply revert the changed php.ini setting back to it's default (at your own risk)
Hi,
I've followed the instructions here and on the Facebook getting-started guide but unfortunately, I can't seem to be able to generate a short-lived access token using this (or any other) library in PHP.
I was able to create an access code (needed to generate the short-lived token), but didn't get any further than that; at least not using PHP. I was able to get a bit further by using the cURL in the terminal, but that's more of a workaround.
I can echo the $apiCall URL in the _makeOAuthCall method, copy and paste the URI into a browser and voilà, everything works as expected and I get a short-lived access token. The same goes for generating a long-lived access token or refreshing an existing long-lived token, no dice using PHP and cURL. No problem using HTTP in any browser. I've tried both methods on an entirely different web server (different IP, different location, different hoster) with the same results.
When using PHP and cURL, with or without this library, I always get the following response: IGApiException: Invalid OAuth 2.0 Access Token with error code 190
When calling any of the three mentioned endpoints in a browser directly, everything works like a charm. What gives?
Here's a link to a post on stackoverflow regarding this issue: https://stackoverflow.com/questions/63601362/refreshing-instagram-long-lived-access-token-works-in-browser-http-but-not-php
Any help is greatly appreciated, thanks!