Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The AspNetUserLogins table Identity [closed]

What is the AspNetUserLogins for? Is It to store the logins from the user? How can I then update this table with that data?

like image 362
Bryan Avatar asked Feb 02 '16 13:02

Bryan


People also ask

What is AspNetUserLogins table?

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.

How do I change the table name on AspNetUser?

You can do this easily by modifying the IdentityModel. cs as per the below: Override OnModelCreating in your DbContext then add the following, this will change AspNetUser table to "Users" you can also change the field names the default Id column will become User_Id.

What is AspNetUserTokens?

The table AspNetUserTokens is for external authentication token storage and is filled by SignInManager.


1 Answers

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.

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.

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

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.

read more about external providers here

like image 92
Preet Singh Avatar answered Nov 08 '22 00:11

Preet Singh