Search code examples
amazon-web-servicesflaskamazon-ec2paypal

AWS post request issue


I have deployed my Flask application on AWS. I am trying to send POST requests from the AWS Flask server to PayPal's REST APIs. Occasionally, the requests fail. This typically happens when I attempt to send a request after a day or two. When the request fails, I resolve the issue by restarting my AWS server, and everything works smoothly afterward. Could you please help me identify the potential issue, as everything functions correctly after a server restart?


Solution

  • PayPal REST API oauth2 access_tokens are valid (and so can be cached and reused) for 9 hours, after which a new one must be obtained (using the client ID and secret)

    So if you are only requesting an access_token on startup, that would explain the described behavior