SammyK / LaravelFacebookSdk

Fully unit tested Facebook SDK v5 integration for Laravel & Lumen
MIT License
692 stars 200 forks source link

Need help to get the fb_id or email #178

Open johnef opened 7 years ago

johnef commented 7 years ago

What I am doing? I am working on vote app which the users should vote one time on each category on this app

What I need? on each items there is a vote button, I want the clients to click vote and than check if he voted before or not if he voted before he should redirect back with message say you have voted before. else store his email into my database table and do the voting.

What I done? I made my fb application, installed the package and add the providers, aliases and I added the route

Should I put this routes??

Route::get('/facebook/login', function(SammyK\LaravelFacebookSdk\LaravelFacebookSdk $fb)
{
    // Send an array of permissions to request
    $login_url = $fb->getLoginUrl(['email']);

    // Obviously you'd do this in blade :)
    echo '<a href="' . $login_url . '">Login with Facebook</a>';
});

I made my vote button like this <a class="vote-btn" href="https://www.facebook.com/v2.9/dialog/oauth?client_id=139382809958016&state=e9980a6c35601c495e9a68ae13fb0afb&response_type=code&sdk=php-sdk-5.5.0&redirect_uri=http%3A%2F%2Flocalhost%3A8000%2Fvote%2F1&scope=email">vote</a>

I try it without putting any routes and it's redirecting to the Facebook is this right??

I need help on

1- when client clicks on the vote button I need to get his email and add it into variable so I can use it. 2- if I have to use the Route as showing above I need to add these into controller so I can make my check process.

thanks