Search code examples
phpoauth-2.0instagramlaravel-5.1instagram-api

Unable to get access token from instagram


Im using this instagram wrapper package for laravel 5.1. Im trying to connect to instagram thorugh the API then auth a user in using

use Vinkla\Instagram\Facades\Instagram;
public function instagramlogin(Request $request)
{
    // Get code parameter.
    $code = $request->get('code');

    // Request the access token.
    $data = Instagram::getOAuthToken($code);

    // Set the access token with $data object.
    Instagram::setAccessToken($data);

    // We're done here - how easy was that, it just works!
    Instagram::getUserLikes();
    // This example is simple, and there are far more methods available.
}

and then be able to get access to his/her profile data. but I keep getting an error stating

ErrorException in Instagram.php line 526:
Undefined property: stdClass::$access_token

How do I auth a user?


Solution

  • I solved this problem. You basically have to use the cosenary instagram package as this package is a wrapper for that package. So if you run through the documentation on the cosenary package and use facades instead, the functions will work.