mercredi 30 août 2017

How to design a user system with socialite user and local user?

I use Laravel 5.4 framework and mongodb to build an SSO application.I have already implemented the local user login and register function.

Now I need add socialite user auth to my application.I add some Laravel Socialite Package.

The problem is should I make collections for every kind of socialite platform?

I think the easy way is that add a field oauth to the users collection. And when user login with a socialite platform I can get the user's socialite ID.At last I just add the socialite platform name and ID to field oauth.The data object like this:

{
 "username":"foo",
 "oauth":{
   "github":{"id":"1234abc","token":"123abc"}
 }
}

But I found this users collection for login action may be slow.Because the key to validate user whether registered with the socialite platform or not need scan the "oauth" field and its sub object ('github','facebook',.etc)

If I make a github-user collection for that github platform then I only need to check the github-user collection by field id and it may be fast.

Sorry about my mongodb useage because I am new for mongodb and used mysql for some years.With mysql I must make table for each socialite platform.

PS: user amount is about 5 million.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2wJapIM
via IFTTT

Aucun commentaire:

Enregistrer un commentaire