Issue with twitteR package


#1

Hey,

I am having an issue when trying authentication with OAuth. When I enter this Cred$handshake(cainfo = system.file(“CurlSSL”, “cacert.pem”, package = “RCurl”) )

an error message is displayed : " Error in strsplit(response, “&”) : non-character argument "

I found this discussion (http://lists.hexdump.org/pipermail/twitter-users-hexdump.org/2012-February/000069.html) and tried the suggested solution but doesn’t work in my case…

I am using R 3.0.1 and twitteR version is 1.1.6


#2

Same issue.

I’m trying the following

library(twitteR) options( RCurlOptions = list(verbose = TRUE, proxy = "http://mycompany.com:10080", ssl.verifyhost=FALSE, ssl.verifypeer=FALSE, cainfo="C:\\Program Files\\R\\R-3.0.1\\library\\RCurl\\CurlSSL\\cacert.pem")) cred <- OAuthFactory$new(consumerKey="xxxx", consumerSecret="yyyy", requestURL="https://api.twitter.com/oauth/request_token", accessURL="https://api.twitter.com/oauth/access_token", authURL="https://api.twitter.com/oauth/authorize") cred$handshake()

Did you get any solution?
I’m using twitteR_1.1.6 with ROAuth_0.9.3 and RCurl_1.95-4.1


#3

I have the same problem

cred$handshake()

  • About to connect() to proxy myproxy.com port 80 (#3)
  • Trying 151.10.54.147…
  • Adding handle: conn: 0x3f05fd0
  • Adding handle: send: 0
  • Adding handle: recv: 0
  • Curl_addHandleToPipeline: length: 1
    • Conn 3 (0x3f05fd0) send_pipe: 1, recv_pipe: 0
  • Connected to myproxy.com (151.10.54.147) port 80 (#3)
  • Establish HTTP proxy tunnel to api.twitter.com:443

CONNECT api.twitter.com:443 HTTP/1.1
Host: api.twitter.com:443
Proxy-Connection: Keep-Alive

< HTTP/1.1 200 Connection established
<

  • Proxy replied OK to CONNECT request
  • found 126 certificates in /usr/local/lib/R/site-library/RCurl/CurlSSL/cacert.pem
  •    server certificate verification SKIPPED
    
  •    compression: NULL
    
  •    cipher: ARCFOUR-128
    
  •    MAC: SHA1
    

POST /oauth/request_token HTTP/1.1
Host: api.twitter.com
Accept: /
Content-Length: 212
Content-Type: application/x-www-form-urlencoded

  • upload completely sent off: 212 out of 212 bytes
    < HTTP/1.1 200 OK
    < cache-control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0
    < content-length: 146
    < content-type: text/html; charset=utf-8
    < date: Fri, 14 Jun 2013 10:45:35 GMT
    < etag: “d990618bb28b9d22c2e7123ad02ee9d9”
    < expires: Tue, 31 Mar 1981 05:00:00 GMT
    < last-modified: Fri, 14 Jun 2013 10:45:35 GMT
    < pragma: no-cache
  • Server tfe is not blacklisted
    < server: tfe
    < set-cookie: _twitter_sess=XXXX%252FAToHaWQiJTIyODRhNmIyZWJhMjIw%250AN2JmNmVkMDE4Y2I2MmYxNmUw–8606efb785023e757d77ece5879ce637f574273a; domain=.twitter.com; path=/; HttpOnly
    < set-cookie: guest_id=v1%3A137120673501582753; Domain=.twitter.com; Path=/; Expires=Sun, 14-Jun-2015 10:45:35 UTC
    < status: 200 OK
    < strict-transport-security: max-age=631138519
    < vary: Accept-Encoding
    < x-frame-options: SAMEORIGIN
    < x-mid: 6ec611c53c567f12c26a09a762e49920e2277a61
    < x-runtime: 0.01346
    < x-transaction: cc6bf3a0efb5dc28
    < x-ua-compatible: IE=10,chrome=1
    < x-xss-protection: 1; mode=block
    <
  • Connection #3 to host myproxy.com left intact
    Error in strsplit(response, “&”) : non-character argument

Any suggestion?


#4

same problem, only when accessing through a proxy

cred$handshake()

  • About to connect() to proxy myproxy.com port 80 (#3)
  • Trying 151.10.54.147…
  • Adding handle: conn: 0x3f05fd0
  • Adding handle: send: 0
  • Adding handle: recv: 0
  • Curl_addHandleToPipeline: length: 1
    • Conn 3 (0x3f05fd0) send_pipe: 1, recv_pipe: 0
  • Connected to myproxy.com (151.10.54.147) port 80 (#3)
  • Establish HTTP proxy tunnel to api.twitter.com:443

CONNECT api.twitter.com:443 HTTP/1.1
Host: api.twitter.com:443
Proxy-Connection: Keep-Alive

< HTTP/1.1 200 Connection established
<

  • Proxy replied OK to CONNECT request
  • found 126 certificates in /usr/local/lib/R/site-library/RCurl/CurlSSL/cacert.pem
  •    server certificate verification SKIPPED
    
  •    compression: NULL
    
  •    cipher: ARCFOUR-128
    
  •    MAC: SHA1
    

POST /oauth/request_token HTTP/1.1
Host: api.twitter.com
Accept: /
Content-Length: 212
Content-Type: application/x-www-form-urlencoded

  • upload completely sent off: 212 out of 212 bytes
    < HTTP/1.1 200 OK
    < cache-control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0
    < content-length: 146
    < content-type: text/html; charset=utf-8
    < date: Fri, 14 Jun 2013 10:45:35 GMT
    < etag: “d990618bb28b9d22c2e7123ad02ee9d9”
    < expires: Tue, 31 Mar 1981 05:00:00 GMT
    < last-modified: Fri, 14 Jun 2013 10:45:35 GMT
    < pragma: no-cache
  • Server tfe is not blacklisted
    < server: tfe
    < set-cookie: _twitter_sess=XXXX%252FAToHaWQiJTIyODRhNmIyZWJhMjIw%250AN2JmNmVkMDE4Y2I2MmYxNmUw–8606efb785023e757d77ece5879ce637f574273a; domain=.twitter.com; path=/; HttpOnly
    < set-cookie: guest_id=v1%3A137120673501582753; Domain=.twitter.com; Path=/; Expires=Sun, 14-Jun-2015 10:45:35 UTC
    < status: 200 OK
    < strict-transport-security: max-age=631138519
    < vary: Accept-Encoding
    < x-frame-options: SAMEORIGIN
    < x-mid: 6ec611c53c567f12c26a09a762e49920e2277a61
    < x-runtime: 0.01346
    < x-transaction: cc6bf3a0efb5dc28
    < x-ua-compatible: IE=10,chrome=1
    < x-xss-protection: 1; mode=block
    <
  • Connection #3 to host myproxy.com left intact
    Error in strsplit(response, “&”) : non-character argument

Any suggestion?


#5

This problem occurs when you use https as the protocol for the URLs. In this case, the handshake function will be returned a vector of class raw rather than character. Change your URLs to http and it should work.


#6

I am getting the same problem.If I changed to http then I got forbidden error,if you give any other solution it will be a great help for me

this is the error I am getting

About to connect() to proxy twitter.com port 8000 (#0)

  • Trying 199.59.149.198… * Connection refused
  • Trying 199.59.148.10… * Connection refused
  • Trying 199.59.150.39… * Connection refused
  • couldn’t connect to host
  • Closing connection #0
    Error in function (type, msg, asError = TRUE) : couldn’t connect to host

options( RCurlOptions = list(verbose = TRUE, proxy = “https://10.138.90.12:8000”, ssl.verifyhost=FALSE, ssl.verifypeer=FALSE, cainfo="/home/587141/cacert.pem"))
myCred$handshake()

  • About to connect() to proxy 10.138.90.12 port 8000 (#0)
  • Trying 10.138.90.12… * connected
  • Connected to 10.138.90.12 (10.138.90.12) port 8000 (#0)
  • Establish HTTP proxy tunnel to api.twitter.com:443

CONNECT api.twitter.com:443 HTTP/1.1
Host: api.twitter.com:443
Proxy-Connection: Keep-Alive

< HTTP/1.0 200 Connection established
<

  • Proxy replied OK to CONNECT request
  • skipping SSL peer certificate verification
  • SSL connection using SSL_RSA_WITH_RC4_128_SHA
  • Server certificate:
  • subject: CN=api.twitter.com,OU=Twitter Security,O=“Twitter, Inc.”,L=San Francisco,ST=California,C=US
  • start date: Oct 10 00:00:00 2013 GMT
  • expire date: Oct 10 23:59:59 2014 GMT
  • common name: api.twitter.com
  • issuer: CN=VeriSign Class 3 Secure Server CA - G3,OU=Terms of use at https://www.verisign.com/rpa ©10,OU=VeriSign Trust Network,O=“VeriSign, Inc.”,C=US

POST /oauth/request_token HTTP/1.1
Host: api.twitter.com
Accept: /
Content-Length: 214
Content-Type: application/x-www-form-urlencoded

< HTTP/1.1 200 OK
< cache-control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0
< content-length: 147
< content-type: text/html; charset=utf-8
< date: Tue, 04 Feb 2014 05:53:39 GMT
< etag: “d7a45452b2ec469ea519c72dfb390688”
< expires: Tue, 31 Mar 1981 05:00:00 GMT
< last-modified: Tue, 04 Feb 2014 05:53:39 GMT
< pragma: no-cache
< server: tfe
< set-cookie: _twitter_sess=BAh7BzoHaWQiJWUzZjkwZmMwNjRkYzgzZWI3Njc1ODExMWYzNGYyNTgzOg9j%250AcmVhdGVkX2F0bCsICIZ1%252B0MB–2443bcc78c0878b44d6bef0ad9637da5ededeacb; domain=.twitter.com; path=/; secure; HttpOnly
< set-cookie: guest_id=v1%3A139149321983178676; Domain=.twitter.com; Path=/; Expires=Thu, 04-Feb-2016 05:53:39 UTC
< status: 200 OK
< strict-transport-security: max-age=631138519
< vary: Accept-Encoding
< x-frame-options: SAMEORIGIN
< x-mid: e63d7117fd89481f4883481f27e07d6934686a52
< x-runtime: 0.01421
< x-transaction: 281c0985b0304e48
< x-ua-compatible: IE=10,chrome=1
< x-xss-protection: 1; mode=block
<

  • Connection #0 to host 10.138.90.12 left intact
    Error in strsplit(response, “&”) : non-character argument

#7

Same Problem here. If anyone knows how to fix this, it would be greatly appreciated.

Neither https nor http work:

cred <- OAuthFactory$new(consumerKey = “----------------”, consumerSecret = “----------------”, requestURL = “https://api.twitter.com/oauth/request_token”, accessURL = “https://api.twitter.com/oauth/access_token”, authURL = “https://api.twitter.com/oauth/authorize”)

cred$handshake(cainfo = “cacert.pem”)
Error in strsplit(response, “&”) : non-character argument
cred <- OAuthFactory$new(consumerKey = “----------------”, consumerSecret = “----------------”, requestURL = “http://api.twitter.com/oauth/request_token”, accessURL = “http://api.twitter.com/oauth/access_token”, authURL = “http://api.twitter.com/oauth/authorize”)

cred$handshake(cainfo = “cacert.pem”)
Error: Forbidden


#8

ALL httpS worked for me.

download.file(url=“http://curl.haxx.se/ca/cacert.pem”, destfile=“cacert.pem”)
options(RCurlOptions = list(cainfo = system.file(“CurlSSL”, “cacert.pem”, package = “RCurl”)))
cred <- OAuthFactory$new(consumerKey=’****’,
consumerSecret='
’,
requestURL=‘https://api.twitter.com/oauth/request_token’,
accessURL=‘https://api.twitter.com/oauth/access_token’,
authURL=‘https://api.twitter.com/oauth/authorize’)

cred$handshake(cainfo=‘cacert.pem’)


#9

Could you please help me on how I can solve the following problem in R:

> twitCred$handshake()
To enable the connection, please direct your web browser to:
http://api.twitter.com/oauth/authorize?oauth_token=OdB28pxghH4qGjGKTq5pMaEyrJk7ankT9xWfZs7x4
When complete, record the PIN given to you and provide it here: 5345731
Error: Forbidden