Monday, May 7, 2018

[WebAPI] HELP: Extending ASP Identity to custom models

Context:
I have a simple app (SQL Server, .NET Backend with OAuth, Angular 5) which currently just has basic sign up/sign in functionality with token based auth. This is working correctly and as expected, with the auto-generated tables from the Identity system.
Using the DB first approach I created some new tables in the database for other User profile functionality, and their relative DTOs in the code. One of my custom tables joins to the Identity ApplicationUser table with a one-to-one relationship on UserID. +

The issue that I am facing is how to query my custom table given the currently logged in user from the front end. Simply requesting the User.Identity.GetUserID() function returns null and returns a server error to my Angular app. What I am essentially looking for is some way for my front end to hit an API end point to return an instance of that User Profile (custom table). That end point should recognize the logged-in user making the request, join to the custom table from its Identity table ID without needing to expose or pass around the IDs inside the Angular application.
I'm very new to API development, so I could be barking up the wrong tree entirely.

[WebAPI] HELP: Extending ASP Identity to custom models Click here
  • Blogger Comment
  • Facebook Comment

0 comments:

Post a Comment

The webdev Team