You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using the laravel-oauth2 package for Laravel 4 to set up a Facebook login. I am using the package seen here: https://github.com/madewithlove/laravel-oauth2 (which is based on your repository here).
When running the page that controls the login, the public/oauth/facebook, the Facebook prompt comes up fine, but when I click "accept", the page spits out the following error:
ErrorException
Argument 1 passed to OAuth2\Provider\Facebook::get_user_info() must be an instance of OAuth2\Token\Token_Access, instance of OAuth2\Token_Access given, called in /Applications/MAMP/htdocs/crowdsets/laravel-master/app/controllers/Oauth2Controller.php on line 36 and defined
It is pointing to /vendor/taylorotwell/laravel-oauth2/src/OAuth2/Provider/Facebook.php: 26
The get_user_info() function in Facebook.php looks like this:
'****************',
'secret' => '********************',
));
if(! isset($_GET['code'])) {
return $provider->authorize();
}
else
{
// Howzit?
try
{
$params = $provider->access($_GET['code']);
$token = new Token_Access(array(
'access_token' => $params->access_token
));
$user = $provider->get_user_info($token);
// Here you should use this information to A) look for a user B) help a new user sign up with existing data.
// If you store it all in a cookie and redirect to a registration page this is crazy-simple.
echo "
";
var_dump($user);
}
catch (OAuth2_Exception $e)
{
show_error('That didnt work: '.$e);
}
}
}
```
}
I am not sure why it is given me this error, as I followed the documentation and tutorials. Thank you for your help with solving this issue.
The text was updated successfully, but these errors were encountered:
I am using the laravel-oauth2 package for Laravel 4 to set up a Facebook login. I am using the package seen here: https://github.com/madewithlove/laravel-oauth2 (which is based on your repository here).
When running the page that controls the login, the public/oauth/facebook, the Facebook prompt comes up fine, but when I click "accept", the page spits out the following error:
ErrorException
Argument 1 passed to OAuth2\Provider\Facebook::get_user_info() must be an instance of OAuth2\Token\Token_Access, instance of OAuth2\Token_Access given, called in /Applications/MAMP/htdocs/crowdsets/laravel-master/app/controllers/Oauth2Controller.php on line 36 and defined
It is pointing to /vendor/taylorotwell/laravel-oauth2/src/OAuth2/Provider/Facebook.php: 26
The get_user_info() function in Facebook.php looks like this:
public function get_user_info(Token_Access $token)
{
$url = 'https://graph.facebook.com/me?'.http_build_query(array(
'access_token' => $token->access_token,
));
My Oauth2Controller.php file looks like this:
'****************', 'secret' => '********************', )); if(! isset($_GET['code'])) { return $provider->authorize(); } else { // Howzit? try { $params = $provider->access($_GET['code']); $token = new Token_Access(array( 'access_token' => $params->access_token )); $user = $provider->get_user_info($token); // Here you should use this information to A) look for a user B) help a new user sign up with existing data. // If you store it all in a cookie and redirect to a registration page this is crazy-simple. echo "The text was updated successfully, but these errors were encountered: