Aspnetcore: [Identity] Edit User Profile -> Add another service to log in throw InvalidOperationException

Created on 30 Apr 2019  Â·  2Comments  Â·  Source: dotnet/aspnetcore

Describe the bug

Add external login to a logged in user will throw InvalidOperationException if the external login is already connected to another existing account.

To Reproduce

Steps to reproduce the behavior:

  1. Using this version of ASP.NET Core '3.0.100-preview4-011223'.
  2. Create a new Web Application MVC with Identity enabled.
  3. Execute database migration to create the identity db.
  4. Configure one or more valid external login in Startup.cs (Google, Facebook…).
  5. Add all Identity Views with scaffolding.
  6. Run the website and register a user with username and password.
  7. After login in the profile page -> 'External Logins' connect one external login to the current account.
  8. Logout and register a second user with new credential.
  9. After login go to the profile page -> 'External Logins' and try to connect the same external login to this second account.
  10. The app will throw:

InvalidOperationException: Unexpected error occurred adding external login for user with ID '...'. MultipleIdentity.Server.Areas.Identity.Pages.Account.Manage.ExternalLoginsModel.OnGetLinkLoginCallbackAsync() in ExternalLogins.cshtml.cs, line 102

Expected behavior

Anything except an exception.

Screenshots

Error

Done area-identity bug identity-UI

All 2 comments

Putting this in preview 8 as its just a simple change to set the status message instead of throwing an excpetion

Was this page helpful?
0 / 5 - 0 ratings

Related issues

glennc picture glennc  Â·  117Comments

rmarinho picture rmarinho  Â·  78Comments

kevinchalet picture kevinchalet  Â·  761Comments

natemcmaster picture natemcmaster  Â·  213Comments

reduckted picture reduckted  Â·  91Comments