Adding the GenerateRandomPassword() method

The username isn't the only "missing" required field we need to take care of when a user registers themselves with a third-party provider, and we want to create their account to our existing identity data model; we also need to generate a password.

Such a task is not trivial as it might seem, for at least two reasons:

  • We cannot set up a weak password, otherwise other users might be able to break into that user's account
  • We cannot set up a weak password, because the ASP.NET Core Identity will refuse it

More specifically, if we recall correctly, what we did back in Chapter 8, Authentication and Authorization, when we added the Identity service to the Startup.cs file, we need a password with at least ...

Get ASP.NET Core 2 and Angular 5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.