How is oauth designed after authorization?

Source: Internet
Author: User
For example, I obtained some basic information through oauth authorization: user name, user profile, and email. what is the design? The password field in the user table has been set to not empty, and the user name is set to unique. you cannot directly store the obtained information, and the user foreign key in the openid table is not... as the question, pass OauthAuthorization, get some basic information: user name, user profile, email

What is the future design?

User tableThe password field in has been setNot emptyAnd the user name is setUniqueYou cannot directly store the obtained information, and the user foreign key in the openid table cannot be easily obtained. In addition, do you need to download the obtained user profile to a local device? Could anyone give me a thought, Thank you

Reply content:

As the question, passOauthAuthorization, get some basic information: user name, user profile, email

What is the future design?

User tableThe password field in has been setNot emptyAnd the user name is setUniqueYou cannot directly store the obtained information, and the user foreign key in the openid table cannot be easily obtained. In addition, do you need to download the obtained user profile to a local device? Could anyone give me a thought, Thank you

After the next oauth authorization is corrected, the desired user information is not called the user name. it should be called a "nickname" for the local system"

The user table used by the local system should not be affected. it should exist as the external table 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 logon process is roughly as follows, depending on the product business logic. There are many design methods

  1. QQ, Weibo, and other information obtained after authorized logon

  2. Determine whether openid exists in user_openid. if it does not exist, save it first. if it exists, determine whether there is user_id. if it does, log on. if it does not exist, complete the registration information required by the user table, similar to registering and binding a third-party login account

  3. Generally, the user Center can bind other third-party accounts, such as segmentfault.

  4. After the above steps are completed, normal user name and password logon and all third-party accounts can be supported.

  5. We recommend that you consider other detailed scenarios based on the business logic.

As for whether the avatar can be stored or not, the Avatar address provided by a third-party account will not expire. if you encounter specific problems in your product, you can optimize it.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.