My pleasure - it's been a fun exercise but I'm hoping we can build a more integrated solution before too long.
I spent some time putting together a proof of concept based on the workaround that we discussed yesterday, which I'll share below. Don't judge me - it's been a while since I did true app development outside of Retool! Here's a recording of it in action. Note that I'm using Google as an example because Pinterest denied my API request.
Right now the actual custom auth as defined in Retool simply redirects to the OAuth2 authorization page. Everything from there is handled by the lightweight server that I put together. It's currently just running on my local machine, so the redirect_uri
is a localhost
address. You can check out the server code here.
The end result is that the user's access_token
gets stored in RetoolDB for later use. I initially wasn't sure how to best associate the token with a particular user, but Google returns an id_token
if you ask for the appropriate scope - email
, in this case - which sufficed. I would double check Pinterest's documentation to see if they support something similar. They might also allow you to extend the lifetime of the token so that you don't need to re-auth as often.
Last but not least, I put together a quick outline of what it might look like to "schedule" pins and actually post to Pinterest.
This is very much a quick-and-dirty implementation, but you can see that the workflow runs every day at 3pm. I grab all the pins that are scheduled for today from the database, along with necessary user information. Then I just loop through them and hit Pinterest's Create Pin endpoint.
There's obviously a ton you can do to improve this, especially when it comes to error handling. But hopefully it's proof of concept enough to give you a starting point!