title: Sending automated emails using Gmail API with Python and OAuth authentication
body: <p>I have a Python code that was using SendGrid API to send emails, but now I want to migrate to Google in order to send business emails. It also runs in Docker containers.</p>
  <p>I followed <a href="https://developers.google.com/gmail/api/quickstart/python" rel="nofollow noreferrer">Gmail Python Quickstart</a> in order to use Gmail API in my Python code and the problem is that when trying to send email, it shows an authorization link in <a href="https://en.wikipedia.org/wiki/Docker_%28software%29" rel="nofollow noreferrer">Docker</a> logs in order to get token, etc.</p>
  <p>Is there a way to complete authorization in the background without any further interaction or use an API key just like SendGrid to programmatically authenticate your application?</p>
  <p>I am a service provider and want to send emails such as reset password links, confirmation code, etc. automatically; the code is deployed on a Linux host. I have access to workspace account, and I already have verified my domain.</p>