Work with multiple login systems (Facebook Connect, Google Account and others)

If you want users of your site to be able to log in using Facebook Connect, a Google account, etc., how do you create your database so that they are all integrated?

+3
source share
3 answers

I suggest using an account table to store your local account data, which will then be associated with the AthenticationMethods table or credential table, which will store the associated external authentication data. This allows your site and all its complexity to be associated with Accounts and the login process, to perfectly abstract from the various forms of authentication that you might want to support. Given that each authentication method can have different levels of complexity, I suggest looking at the various APIs and cross-referencing them to find common similarities. More importantly, you want to find where they are different, so that the credential table can handle the different bits of data that each API may require. Remember to enable OpenID!

+2

. "externalSystemId" (TINYINT), - "externalId" (DOUBLE). , externalSystemId, .. EXTERNAL_SYSTEM_FACEBOOK = 1, EXTERNAL_SYSTEM_OPENID = 2 .. - , , .

User , , -, , externalSystemId.

, , , , , .

0

Are you sure you want to save other information than "login": "password"? I would recommend that you have an enumeration to save the login system from which the user comes from.

0
source

Source: https://habr.com/ru/post/1711138/


All Articles