muhdazrain/opauth-instagram — pull request #3 by neemzy (2013-10-03 14:23:51+00:00)
Title: quick fix for Instagram's API bug, to ensure valid JSON

Instagram's OAuth service seems to be buggy : every response I get from it consists of valid JSON appended with a random character (most of the time something unprintable, displayed as the dreaded black diamond, but I had a couple of t's, f's and ^'s).

Example : `{"access_token":"some.access.token","user":{"username":"someuser","bio":"","website":"","profile_picture":"http:\/\/images.ak.instagram.com\/profiles\/anonymousUser.jpg","full_name":"","id":"someid"}}f`

This does not seem to be related to Opauth or to this very Strategy as the extra character is already present in the raw JSON returned by `file_get_contents` (OpauthStrategy.php, line 422).

This **quick and dirty** fix (certainly not meant to last) aims at going around this problem for now, by right-trimming the returned JSON while its last character is not `}`.

**I will understand perfectly if you don't merge this, but at least people will be able to know of and use my fork if they need to.**