schedula / laravel-passport-socialite

The missing social authentication plugin (i.e. SocialGrant) for laravel passport.
MIT License
50 stars 31 forks source link

SocialAccount - what is this class? #2

Closed mst101 closed 6 years ago

anandsiddharth commented 6 years ago

If you are asking SocialAccount which is in the example it's a laravel model i.e. database table. from where I am querying if the user id exists with a certain 3rd party oauth provider i.e. facebook. It's clearly understandable from the example since it has where methods called. Hope this answers your question.

Peace, Anand Siddharth

mst101 commented 6 years ago

Thank you. It's more understandable now that you've updated the example. Maybe you could include the migration as part of your package?

A couple of other minor tweaks:

  1. The loginFacebook method should have an arrow, not a colon: return response()->json(["error" => $e->getMessage() ]);

  2. The issueToken method needs to accept the $request parameter.

I still need to get my head round all this, but it looks promising...

anandsiddharth commented 6 years ago

Hi, thanks for pointing out the mistakes in readme! I have updated it.

The reason why I haven't added the migration (i.e. social_accounts table) to the package is, the developer should have the flexibility to choose what to store and what not to from 3rd party provider. to facilitate that their's an interface Anand\Laravel\PassportSocialite\User\UserSocialAccount provided which must be implemented on user model and then a function findForPassportSocialite is added to it which returns the user object using the provided input i.e. provider and id, if it satisfies the developer's conditions or else null to the package and then package generates or refuses the request to generate access token.

Peace, Anand Siddharth