Hacker News new | ask | show | jobs
by cairo140 3976 days ago
Can you just have person A supply to personb.com the path to person A's sharing service (in this case persona.com) and craft share links to person A's sharing service pointing to the content from personb.com you want to share?

Let's say:

Share endpoint /share?content=URL

Content endpoint /content/ID

If personb.com knows that the client shares from persona.com/share, it can craft its share links as (excuse the escaping)

    <a href="https://persona.com/share?content=http://personb.com/content/5</a>
When person A follows the link, they get sent to persona.com, authenticated using their cookie, and then the persona.com web service follows the content URL to fetch the content to share.

This seems to address your core use case as well as your stated kicker (you can't craft a request to get person A to reshare something they don't want to since persona.com/share can auth person A and confirm the share).

This is all essential how Facebook, G+, Twitter sharing all work, except you don't pass to your content site the share endpoint because it uses canonical endpoints built in.

1 comments

This would be the ideal workflow because it's non platform dependent (works on desktop and mobile browsers with no additional steps). The question is, how does the browser tell personb.com that the reshare point for the current visitor (person A) is persona.com.

Struggled with this since there doesn't seem to be a way for the browser to set a value that's writable by one site but readable by any site

I don't think you can make something like this fully distributed with current web technologies, but one solution would be to use a centralised domain for identification.

When Person A signs up / logs in their instance includes an iframe at personident.com which sets a cookie saying their instance is persona.com.

When they visit Person B's site the include an iframe for the share endpoint at personident.com. That knows about persona.com, so displays a button to share to their instance.

Iframes may sound nasty but this is how all the social sharing buttons work at the moment. I think the code on personident.com could just be JavaScript, so hosting would be easy.