C
C#10mo ago
AsadSultan

can we send extra data in .net8 identity endpoints

i need to send some extra data add the time of register. this register end point only allow email and password
12 Replies
gwon8266
gwon826610mo ago
You will have to create a new ApplicationUser entity that extends the IdentityUser. In this new ApplicationUser entity, you can add the properties or fields you want.
AsadSultan
AsadSultanOP10mo ago
you means add other entity instead of IdentityUser builder.Services.AddIdentityApiEndpoints<IdentityUser>()
gwon8266
gwon826610mo ago
You can try it and see if it works.
AsadSultan
AsadSultanOP10mo ago
i dont change IdentityUser butt i add another property (username) in register request but its not update db wth this
No description
AsadSultan
AsadSultanOP10mo ago
No description
gwon8266
gwon826610mo ago
It might be because the UserName is set internally. Try it with PhoneNumber and see if it updates.
AsadSultan
AsadSultanOP10mo ago
i also try with phone number its not updated phoneNumbr is still null
gwon8266
gwon826610mo ago
Have you used your debugger to find out where the problem is coming from?
AsadSultan
AsadSultanOP10mo ago
how can debug end point thats are injected witth builder.Services.AddIdentityApiEndpoints<IdentityUser>()
gwon8266
gwon826610mo ago
If its injected, then I honestly don't know. I hope someone else can assist.
AsadSultan
AsadSultanOP10mo ago
ok
Joschi
Joschi10mo ago
You cannot customise the identity endpoints at all. You will have to write your own register endpoint if you need additional information. As far as I know you also cannot disable specific endpoints. That means that the default endpoint will still exist and be operational. If it's a problem, that people could register without that additional information, you probably need to drop the identity endpoints all together and write your own.
Want results from more Discord servers?
Add your server