I'm developing an Android application where the user has requested to use Google Drive as a bootstrap CMS while they develop a real CMS for the second version of the app. This means they will want to access the Drive console and edit documents in it, and our app will then need to retrieve these.
I've determined that the best way to do this is using a regular Drive account that is application-owned, as described here:
Use regular Google accounts as application-owned accounts
This requires us to get OAuth2 credentials for the user. The article linked above links to a secondary article about doing that:
Retrieve and Use OAuth 2.0 Credentials
In it, they show a program for retrieving OAuth2 credentials using an authorization code. According to the drive documentation, it is sufficient to do this once.
How do I get the authorization code given the login/pass combination, and is that really the simplest way to get the OAuth2 credentials once I have?
Moreover, what does the state parameter do and how do you set it?