brucemcpherson / desktopliberation

hosting for desktop liberation google plus community
30 stars 1 forks source link

Apps Script Oauth2 – a Goa Library refresher #135

Open brucemcpherson opened 2 years ago

brucemcpherson commented 2 years ago

It’s been a few years since I first created the Goa library. Initially it was mainly to provide OAuth2 authorization and authentication to be able to access Google APIS and services unavailable via App Script. Nowadays of course, most of that can easily done by adding scopes to your appsscript.json manifest.

However Goa supports services other than Google, and flows other than the usual 3 legged oauth2. This is just a refresher on how Goa works and how to use it using the Twitter 2 API as an example.

Twitter now have a v2 API which uses Oauth2. For their previous API version, you could use Oauth1 or other less secure methods of authentication. Their implementation of Oauth2 is a little funkier than most, so it Goa needed a few more tweaks to support it. That reminded me that I hadn’t posted about it for a while, so here is a complete refresher on Goa, Oauth2 and Apps Script.

I’ll use Twitter as an example provider throughout this article, but it’s a similar process whoever the service provider is. https://ramblings.mcpher.com/apps-script/superfetch-proxy/oauth2-goa-refresher/