artdarek / oauth-4-laravel

OAuth Service Provider for Laravel 4
684 stars 217 forks source link

Save the accesstoken? Getting: Call to undefined method OAuth\OAuth2\Service\Facebook::getAccessToken() #110

Open simplenotezy opened 9 years ago

simplenotezy commented 9 years ago

I wish to save the access token for Facebook in the users table, so I later can query the users facebook.

How is this accomplished? I have tried with:

            $fb = OAuth::consumer( 'Facebook' );
            $fb->getAccessToken();

But that generates this error:

Call to undefined method OAuth\OAuth2\Service\Facebook::getAccessToken()

What do I do wrong?

simplenotezy commented 9 years ago

Solved.

Get access token like this:

                    $token = $fb->requestAccessToken( $code );

                    dd($token->getAccessToken());
shamshi1988 commented 8 years ago

confiax please help me what value have to be passed from the input code to access the $token value i am stuck there