I have a question about developing a webapi. I want to send someone an email with an confirmation Link and If he clicks on it he should be redirected to a thanks page and get a second email with a pdf.
Unfortunatly I have no idea how to create the confirmation link. I can use every web language as php and node js.
Advertisement
Answer
One way to do this is to generate a long and random id and then pass that id as a url parameter.
var key = '25f56c64ee724e15b1b83688e9785a38'; /* Generated Key. */ var link = `https://some-url.com/example/${key}`;
In your database you would have a lookup table that maps the key to the userId.
The route for /example/{key} would then perform a fetch of the user information and generate the page and could also send the email with the pdf.
Note that the security here is is based on the randomness and length of your key. Adding an expiration would be good practice.