Lambda and Using OAuth Refresh Tokens
Problem
Recently I have been working on a project for Online Great Books stitching together Slack Events and Infusionsoft. The Infusionsoft API uses OAuth and the token expires after 24 hours, and then you follow the “standard” flow to refresh it. The API token has a refresh token in it, you use this to generate a new API token, which is again valid for 24h (and includes a new refresh token).
Solution Description
As “serverless” is the new thing, I thought I’d do this entire project with lambdas, but storage and refreshing of the OAuth presented a problem I didn’t know how to solve. I’m not exactly sure where I got the idea, but someone suggested storing the token in Parameter Store and then using a CloudWatch Trigger to schedule a lambda which refreshes the lambda and updates ParamStore.