.Net core has a KeyVault configuration provider that you can use to read secrets within your application.
Please read more about it
here. There is a code sample too on the same page.
For your second question, do you authenticate the user using ASP.Net Identity?
You can write the data to event after the user logs in, just call your logic in the result.Succeeded method in the code sample
here.
-
If this answers your query, do click “Mark as Answer” and Up-Vote for the same which might be beneficial to other community members reading this thread .
And, if you have any further queries do let us know.