Title, by
OAuthAuthorization, access to some basic information: User name, user profile picture, email
What is the design after that?
The password field in the User table is set to not be empty , and the user name is set to unique, cannot directly save the information obtained directly, the user foreign key in the OpenID table is not good, in addition, Is the user avatar downloaded to local? Who can give a thought to Thank you
Reply content:
Title, through oauth authorization, get some basic information: User name, Avatar, email
What is the design after that?
The password field in the User table is set to not be empty , and the user name is set to unique, cannot directly save the information obtained directly, the user foreign key in the OpenID table is not good, in addition, Is the user avatar downloaded to local? Who can give a thought to Thank you
Correct the next OAuth authorization to obtain the user information is not called the user name, for the local system should be called "nickname"
The user table used by the local system should not be affected and should be present as the appearance of the user table, similar to the following
User table
User_id,username,password
User_openid table
User_openid_id,openid,openid_type,user_id,nickname,avatar,email
The authorization login process is probably as follows, depending on the product business logic, there are many design methods
QQ, Weibo, and so on authorized login after access to information
Determine whether OpenID exists in the User_openid, if there is no first save, if there is no user_id, if there is a login, if not to improve the user table required registration information, similar to the registration and binding third-party login account
In general, the User Center will also have a place to bind other third-party accounts, similar to Segmentfault
The above steps to support the normal user name and password login and all third-party account login
It is also recommended to consider some other detail scenarios based on business logic
As for the avatar can be saved, the general third-party account provided by the Avatar address will not expire, if you encounter specific problems in the product can be optimized