简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM