The first step is to fill out your API keys and all of that sort of stuff. Note that this must be done in strict accordance with Google's rules. The scope must match what you've entered on the google auth page, same with the redirect_uri.
Then, use those things to submit a request for an authorization code. You will use this code later to request an authorization token. browseURL() opens a page in your browser window. Log into google (if you aren't already) and look at the resulting URL, it contains your code. Example response would be like this... https://oauth2-login-demo.appspot.com/code?state=/profile&code=4/P7q7W91a-oMsCeLvIaQm6bTrgtp7 You want everything after '&code='
Okay, if successful, you now have an authorization code. Cut and paste that from your browser into the your R code and continue on with a authorization token request.
Now, if you are successful, 'token_code' contains what you need to make a request to the google prediction API. Here's how you try it out on a demo language guessing model.
You should end up with a response like this
All of the code together... https://gist.github.com/corynissen/5774784