Stephen-McDaniel / r-google-analytics

This repository is an export of the final version from the retired Google Code system (code.google.com/p/r-google-analytics).
0 stars 0 forks source link

fromJSON postForm error with Proxy set #21

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Sys.setenv(http_proxy="http://PROXY.com:80")
2. Run Post to get Access Token
3.

What is the expected output? What do you see instead?
I expect to get an access token back.

Instead I get:
Error in fromJSON(postForm("https://accounts.google.com/o/oauth2/token",  : 
  STRING_ELT() can only be applied to a 'character vector', not a 'raw'

What version of the product are you using? On what operating system?
1.4

Please provide any additional information below.

R-3.0.2

Original issue reported on code.google.com by dreyco...@gmail.com on 21 Mar 2014 at 6:32

GoogleCodeExporter commented 9 years ago
issue resolved by changing from:

  rt = fromJSON(postForm('https://accounts.google.com/o/oauth2/token',
                         refresh_token = refreshtoken,
                         client_id = client_id,
                         client_secret = client_secret,
                         grant_type = "refresh_token",
                         style = "POST" ))
#  accesstoken$access_token = rt$access_token
  access_token = rt$access_token

To (resolved by adding rawToChar()):

  rt = fromJSON(rawToChar(postForm('https://accounts.google.com/o/oauth2/token',
                         refresh_token = refreshtoken,
                         client_id = client_id,
                         client_secret = client_secret,
                         grant_type = "refresh_token",
                         style = "POST" )))
#  accesstoken$access_token = rt$access_token
  access_token = rt$access_token

Original comment by dreyco...@gmail.com on 21 Mar 2014 at 6:51