I'm trying to develop a REST API web service. I have a question about how to handle user activation email. Currently, the API service handles email sending.
Here is the flow I have at the moment:
- User registers via the client application
- Client application POSTs to API service
- API service validates and adds the user to the database
- API service sends the User an activation link
- User clicks on the activation link, which will take them to the client application activation page
- Client application activation page POSTs to API service
- Done
Here is where I currently see the issue:
Because the API service is currently sending the email, the client application does not have control over the look and feel of the email. And there may be URLs in the email that should point to the client application.
Another option is instead of the API service sending the activation email, it will return the activation key to the client application. The client application will then be able to send the activation email to the user.
Two issues I see with this strategy:
- Security, as the activation key is now exposed to the client application.
- Not DRY, as each client could be responsible for email sending.
What do you think is best way to handle this?
I would like to allow the client application to customize their email, as well as include client-specific URLs (activation page).