Yes, you can use a web server to receive an OAuth callback that does not require any user interaction.
Basically, you set up your server to receive the oauth code and added uri redirection to the oauth stream so that oauth sends the code to the specified uri, instead of telling the user to enter the code in the text field.
Take a look at tools.run_flow () on google-api-python-client. It has quite convenient code for the local stream of the web server.
source share