brucemcpherson / desktopliberation

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

OAuth2 and Twitter API – App only flow for Apps Script #138

Open brucemcpherson opened 2 years ago

brucemcpherson commented 2 years ago

I covered how to handle the somewhat more complex OAUTH2 authorization flow for the Twitter v2 API (OAuth 2.0 Authorization Code Flow with PKCE) using my Goa library in this article. https://ramblings.mcpher.com/apps-script/superfetch-proxy/oauth2-goa-refresher/

The purpose of that flow is to use the Twitter API (or in my case the SuperFetch plugin – Twitter client for Apps Script https://ramblings.mcpher.com/apps-script/superfetch-proxy/twitter-part-1/) to access a twitter account on behalf of someone who goes through a consent dialog to allow you do so.

There is a rather more straighforward way which supports most of the searching and getting requests you might need without bothering with the consent dialog. Twitter call it the ‘App only’ flow, and instead of the usual authorization code grant flow, it uses instead a credentials grant.

Goa for Apps Script supports this type of flow too, so I’ll show you how to set it up and use it in this article.

https://ramblings.mcpher.com/apps-script/superfetch-proxy/oauth2-goa-refresher/oauth2-and-twitter-api-app-only-flow-for-apps-script/