I have a server side application in python that is calling the AdWords API. Since ClientLogin is being deprecated I'm going to have to use OAuth 2.0. Basically I need to generate an access token but I don't want any user interaction (to allow access the app) because I'm always using the same username and password on the server, and I'd like to use that username and password to make the AdWords API calls.
I believe the right way to do it is through a grant_type of 'password' oauth2 call to https://accounts.google.com/o/oauth2/token. And this is what I understood from the OAuth2.0 RFC (http://tools.ietf.org/html/rfc6749#page-38). The RFC says that the request/query string must contain 3 parameters: grant_type (set to 'password'), username and password.
So I constructed my curl script, which looks like:
curl -v --data "grant_type=password&username=user@gmail.com&password=password" https://accounts.google.com/o/oauth2/token
But I launch the command and I get back with the response from google:
{"error" : "invalid_request"}
Am I missing something? Is there a simple python library that supports grant_type=password and that has a decent enough documentation?