OAuth2 and Twitter API – App only flow for Apps Script

29 views
Skip to first unread message

Bruce Mcpherson

unread,
Jun 30, 2022, 11:40:18 AM6/30/22
to Google Apps Script Community
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/
Reply all
Reply to author
Forward
0 new messages