I have a requirement to automatically delete a user in Identity after their email validation token expires. I need help on how to handle such behavior. Is there a way I can somehow catch the event and put in my delete user code? Please help.
Asked
Active
Viewed 553 times
1
-
1No event is raised when the token expires since that's only a field in the database. You would need to create a job that continually pulls the users that must be deleted manually – Camilo Terevinto Jul 31 '18 at 16:01
1 Answers
1
As mentioned in the comments you will need a way to handle this. One good option is to setup a Serverless function that checks for this condition on a regular interval. Not sure how you plan to publish but this here is an intro for Azure: https://learn.microsoft.com/en-us/azure/azure-functions/.
If you don't want to do something like that then you need to decide if you want to do this on the application layer or the database layer. For example if you want to do this in the application layer you can use a Quartz here is some info on that: https://stackoverflow.com/a/43058170/7446265

rahicks
- 573
- 7
- 19
-
Thanks for your response. I came up with a thought of running a background process to do the operation. I am using hangfire for the background job. I hope asp.net considers such scenarios where they will make provision for custom extensions to perform special requirements like mine – Kacey Ezerioha Aug 01 '18 at 09:06
-
Np. It is one of those fuzzy areas on API's in general. I would like to see better ways to handle it myself. – rahicks Aug 01 '18 at 15:02