C
C#2mo ago
Ellopis

✅ Using Identity with bearer. How do I retrieve the user, or userId in a request?

When doing a request I'm doing
var userId = User.FindFirstValue(ClaimTypes.NameIdentifier);
var blogs = context.Blogs.where(b => userId == b.UserId);
var userId = User.FindFirstValue(ClaimTypes.NameIdentifier);
var blogs = context.Blogs.where(b => userId == b.UserId);
Is this the way of doing it?
2 Replies
many things
many things2mo ago
without knowing anything about the software you're working on it seems ok to me i guess that's a context where user must be authenticated
Unknown User
Unknown User2mo ago
Message Not Public
Sign In & Join Server To View

Did you find this page helpful?