Possibility of triggering 90-day client re-authentication request

Hey all :wave:,

I’ve set up a small “app” to help me keep my credit card paid off each month.

If anyone is interested its some PHP code running in AWS Lambda. When I use my iPhone to pay for groceries I always use my Tesco credit card. With the shortcuts app you can trigger an automation when a specific card is used with ApplePay (it should pass you the total, merchant, etc but it does not so I have it show a numerical text entry) I have it send the total to my function, it checks if my access token is valid, if it is it moved the total amount to a pot, if not it refreshes the token and saves the updated access and refresh token, then moved the money to the pot.

A couple days ago it just stopped working. Looking at the logs I see the token refreshed correctly but the transfer request fails with forbidden.insufficient_permissions. Reading other post I see this is down to the 90-day client restrictions.

I will be adding some error handling to the app to notify me that I need to re-auth in the Monzo app, however it is not exactly a great user experience. Is there a way to trigger the app to “surface” this is out dated (in a similar way to how Monzo will tell me that other bank connections need refreshing).

I see it is discussed here Improve documentation around the mandatory 90 day app re-authentication but there have been no updates in 2 years.

1 Like

I would also hope to see an improved process here, but I suspect its a requirement for some reason? Would really be interested in seeing your code by the way! Also, with your lambda setup, does this require a NAT Gateway setup?

I am planning on publishing the code on GitHub at some point. Once I apply a fix (well, notification/alerting) for the latest issue I’ll probably publish it this week and post an update.

I don’t need NAT gateway but use API gateway to pass incoming HTTP requests to my function. By the looks of it NAT gateway is only needed if the function resides within a VPC?

I use bref.sh (a serverless plugin) to allow me to use PHP via a custom runtime and orchestrate/deploy the code so thankfully I don’t need to be an AWS expert. The only thing I had to manually setup was a DynamoDB instance to store runtime data like pot ID, OAuth tokens etc.

Ah nice setup. I tried writing some python code in lambdas to call the API, but it looked like I needed a NAT Gateway to connect over the internet in the lambda, which was almost £30 a month