AKA “A tale of two share widgets”.
I had an idea for a toy, and I built the toy in a few days. A big part of the toy is sharing the toy with friends; I want my players to tell their friends how well they did. Most of my players should be on Twitter or Facebook; my sharing to those services should be as straightforward as possible.
A “Share your score on Twitter” button took me about 5 minutes. It’s just a link. Add a couple of parameters, and you’re good to go. Tumblr’s just as easy - you have to click through a few options to get the example link, but it is, once again, just a link, so I threw it in as a bonus. But Facebook… oh, Facebook.
Facebook’s sharing process is shamefully convoluted. If you just want to share a URL, you can use a straightforward hyperlink, though it will discourage you[1]. But if you want to share a URL with a description – something Twitter and Tumblr managed with a link – here’s what you have to do on Facebook:
And to top it all off you’re now maintaining that code forever, because Facebook’s API thrashes around like a ferret on a leash. The Share button is deprecated! No, the Share button is supported! You should use the JavaScript Feed Dialog! There’s also this hidden away URL redirection method (which still requires an App ID). And the format might change, so make sure you’re reading Facebook bug reports! But good luck finding them, as they’re excluded from the Google search index. The Facebook developer experience is a fractal of being told to go fuck yourself.
The story might end there. We have to create an app first, but there’s a URL-based version that should be usable. Except, of course, it doesn’t work. I got an error 100: “Invalid parameter (requires valid redirect_uri
).” What is a valid redirect_uri
? What’s an invalid redirect_uri
? There is nothing in the documentation. Why was mine invalid? The error will not tell you. I’d fat-fingered it and missed off an ampersand so I wasn’t supplying a redirect_uri
at all, but there’s a lot of voodoo out there about not escaping the URL or setting your app domain. Obviously I wasted an hour on that before realising my mistake. Couldn’t we have had a “missing required parameter” error instead of “invalid parameter”? No, because then you wouldn’t feel the full force of Facebook’s contempt. And even then, when you’ve finally got it working, mobile users won’t be able to share it.
Move fast and break things is a valid philosophy for a startup, but it doesn’t work if you’re a platform. Cool URLs don’t change; cool APIs don’t flipflop around based on whimsy.
Further reading: oAuth of Fealty by Ian Bogost.