What is the design of OAuth authorization?

Source: Internet
Author: User
Tags oauth openid
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

    1. QQ, Weibo, and so on authorized login after access to information

    2. 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

    3. In general, the User Center will also have a place to bind other third-party accounts, similar to Segmentfault

    4. The above steps to support the normal user name and password login and all third-party account login

    5. 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

  • 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.