'How do you authenticate your YouTube app when using AWS Lambda and Python to upload a video to YouTube

I have created a desktop app in https://console.cloud.google.com that will be used to upload videos to YouTube. I have the code working on my local environment, but every time I run it, it asks me to Enter the authorization code:. After it authenticates, it uploads just fine.

I would like to host this code on AWS Lambda so that every time a new video is uploaded into an S3 bucket, it will trigger the Lambda code and upload the video.

My problem is that I am being asked to authenticate each time the code runs. Since Lambda is serverless, I would not really have a way to authenticate.

What is the best way to host the code in Lambda without having to authenticate the YouTube app each time?

EDIT I believe I found an answer here and here.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source