Skip to content

Instantly share code, notes, and snippets.

@corynissen
Created June 13, 2013 15:40
Show Gist options
  • Save corynissen/5774732 to your computer and use it in GitHub Desktop.
Save corynissen/5774732 to your computer and use it in GitHub Desktop.
google auth token code request
code <- "paste your code from the last step here"
token.curl.request <- paste0('curl -k --header "Content-Type: application/x-www-form-urlencoded" --data "code=',
code, '&client_id=', client_id, '&client_secret=',
client_secret, '&redirect_uri=', redirect_uri,
'&grant_type=authorization_code',
'" https://accounts.google.com/o/oauth2/token')
token <- system(token.curl.request, intern=T)
token_code <- fromJSON(paste(token, collapse=""))$access_token
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment