ASP.NET Core 8 Web API, can't use additional fields with Identity registration
Hello, It's my first time using Identity, so I came across some issues.
When I input json data necessary to register User, it doesn't recongize anything but email and password. (puts null in every other field). I couldn't find the source of the issue, but I think I have to somehow override the registration controller, but I don't know how. (Do I just create separate controller, or can I configure it from program.cs)
7 Replies
This is my model:
DbContext:
Program.cs:
Unknown User•14mo ago
Message Not Public
Sign In & Join Server To View
If your code is too long, you can post to https://paste.mod.gg/ and copy the link into chat for others to see your shared code!
thanks - https://paste.mod.gg/ymyvswkhhaio/0
BlazeBin - ymyvswkhhaio
A tool for sharing your source code with the world!
The MapIdentityApi<User> extension method only adds email and password when registering, as it takes a RegisterRequest containing only those two properties. You'd have to write you own from another controller, and accept whatever you need. You can F12 over the MapIdentityApi<User> to see see the register method.
Thanks, that's exactly what I was looking for