I’m working on a twitter pack, already published at:
However, it’s oAuth2 sessions keep expiring. The Twitter docs says I can do:
POST 'https://api.twitter.com/2/oauth2/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'refresh_token=redacted' \
--data-urlencode 'grant_type=refresh_token' \
--data-urlencode 'client_id=redacted'
However, the Coda docs don’t seem to offer any ability to do these automatic oauth refreshes.
Any suggestion would be great, here is the relevant oAuth2 code I’m currently using:
// https://developer.twitter.com/en/docs/authentication/oauth-2-0/user-access-token
// https://developer.twitter.com/en/docs/twitter-api/users/lookup/api-reference/get-users-me
pack.setUserAuthentication({
type: coda.AuthenticationType.OAuth2,
authorizationUrl: "https://twitter.com/i/oauth2/authorize",
tokenUrl: "https://api.twitter.com/2/oauth2/token",
scopes: ["tweet.read", "tweet.write", "users.read"],
useProofKeyForCodeExchange: true,
getConnectionName: async function (context) {
let response = await context.fetcher.fetch({
url: 'https://api.twitter.com/2/users/me',
method: 'GET',
});
return response.body.data.username;
}
});