Get logged in user name in Core 3.0

To get current logged in user from Identity 2 in .net core 3.0 and 3.1, use the following code.

User.FindFirst(ClaimTypes.Name).Value

Happy Coding 🙂