且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

AspNetUserLogins表标识

更新时间:2023-02-07 13:49:16

AspNetUserLogins的用途是什么? 在Asp.net Identity中,Identity系统使用AspNetUserLogins表保存有关第三方/外部登录的信息,例如通过Google,Facebook,Twitter等登录到您的网站的用户.AspNetUsers表是主表存储用户信息,它通过UserId -> AspNetUsers.Id链接到AspNetUserLogins.

What is the AspNetUserLogins for? In Asp.net Identity, the Identity system uses the AspNetUserLogins table to hold information about 3rd party/external logins, for example users who login into your site via Google, Facebook, Twitter etc. The AspNetUsers table is the primary table to store user information, this is linked to AspNetUserLogins via UserId -> AspNetUsers.Id.

例如,如果用户通过Facebook登录到您的网站,则LoginProvider是提供登录信息的服务的名称,因此在这种情况下," Facebook "中的ProviderKey是与Facebook上的用户相关联的唯一Facebook密钥.

For example if the user logs into your site via Facebook, then the LoginProvider is the name of the service which provided the login, so in this case "Facebook", the ProviderKey is a unique Facebook key associated with the user on Facebook.

Asp.net外部身份验证提供程序使用此表.

This table is used by the Asp.net external authentication providers.

是否要存储用户的登录信息? 不,不是真的,它的用法如上所述

Is it to store the logins from the user? No not really, it is used as explained above

然后如何使用该数据更新该表? 您不更新此表中的数据,通常在用户通过外部提供程序登录时,在对用户进行身份验证之后,提供程序将返回ClaimsIdentity,该表具有用户声明,其中之一是用户的唯一ID.在外部提供程序中,此信息将在此表中自动更新.

How can I then update this table with that data? You don't update the data in this table, usually when a user logs in via external provider, after user has been authenticated, the provider returns a ClaimsIdentity, which has users claims and one of those is a unique id of the user in the external provider, this gets automatically updated in this table.

此处详细了解