Demo: Implement GetLoggedInUser

In the Conduit.Repositories Project, modify AccountRepository.cs file, add the following code to the body of the method:

return await Context
    .Where(u => u.Email == HttpContextAccessor.HttpContext.User.Identity.Name)
    .Include(p => p.Person)

Modify the CreateUser method and add the following code:

if (HttpContextAccessor.HttpContext.Request.Headers.ContainsKey("Authorization"))
    user.Token = HttpContextAccessor
                    .Split(" ")[1];

In the next demo we'll try our newly functional api endpoint.


I finished! On to the next chapter