I am trying to login using social sites in Laravel 5.1. I have installed socialite and following below tutorial:
https://mattstauffer.co/blog/using-github-authentica
It's up to you to manage that.
You can find an interesting discussion that shows a few ways to do what you need.
Once you get redirected from Github you should be able to access the details like so.
$user->getId();
$user->getNickname();
$user->getName();
$user->getEmail();
$user->getAvatar();`
$user->getId() would be the unique id returned from Github.
Save this field somewhere in your database. If you want to add them to your users table you could do something like this:
$newUser = new \App\User;
$newUser->name=$user->getName();
//Or use the nickname
//$newUser->name=$user->getNickname();
$newUser->email=$user->getEmail();
$newUser->social_id=$user->getId();
$newUser->save();
I'm not recommending this as the way to do it, but it should give you enough of an example to make it work.
When someone tries to login with Github, if that ID doesn't exist, either create a new account for them or throw an error.
Just remember, the ID returned is from Github not your webapp. So your user would have an "id" for your web app and a "github_id" that you store so you know what user they belong to.