Is there a way to share a link with only a spefic mail recipient?
<p>Not sure if this question should come to SO, but here it goes.</p>

<p>I have the following scenario:</p>

<p>A Flask app with typical users that can login using username / password. Users can share some resources among them, but now we want to let them share those with anyone, not users of the app basically.</p>

<p>Because the resources content is important, only the person that received the email should be able to access the resource. Not everyone with the link, in other words.</p>

<p>What I've thought so far:</p>

<ul>
<li><p>Create a one-time link -> This could work, but I'd prefer if the link is permanent</p></li>
<li><p>Add some Javascript in the HTML email message sent and add a parameter to the request sent so I can make sure the email address that opened the link was the correct one. This assuming that I can do that with Javascript...which is not clear to me. This will make the link permanent though.</p></li>
</ul>

<p>Any toughts? Thanks</p>

<p>The first time someone accesses the URL, you could send them a random cookie, and save that cookie with the document. On future accesses, check if the cookie matches the saved cookie. If they share the URL with someone, that person won't have the cookie.</p>

<p>Caveats:</p>

<ol>
<li><p>If they share the URL with someone else, and the other person goes to the URL first, <strong>they</strong> will be the one who can access it, not the original recipient.</p></li>
<li><p>If the recipient clears cookies, they'll lose access to the document. You'll need a recovery procedure. This could send a new URL to the original email address.</p></li>
</ol>

javascript python email security