4

i've been trying to use instaR, but failed at getting an access token - getting the response:

Authentication complete.

Error in init_oauth2.0(self$endpoint, self$app, scope = self$params$scope, :

Bad Request (HTTP 400). Failed to get an access token.

when examining the request using with_verbose(), i don't see any additional info.

httr::with_verbose(my_oauth <- instaOAuth(app_id=client_id,app_secret=client_secret))

this is the response i get (masked the client id and secret):

Waiting for authentication in browser... Press Esc/Ctrl + C to abort

Authentication complete.

POST /oauth/access_token HTTP/1.1

Host: api.instagram.com

User-Agent: libcurl/7.43.0 r-curl/2.2 httr/1.2.1

Accept-Encoding: gzip, deflate

Cookie: csrftoken=oLgx7eQh8uZH1ZWMl53lC2y0JJWQkmwd

Accept: application/json, text/xml, application/xml, /

Content-Type: application/x-www-form-urlencoded

Content-Length: 206

client_id=[CLIENT_ID]&redirect_uri=http%3A%2F%2Flocalhost%3A1410%2F%2F&grant_type=authorization_code&code=98e38f8c53354a22bd3786f96cd19e3e&client_secret=[CLIENT_SECRET]

<- HTTP/1.1 400 Bad Request

<- Cache-Control: private, no-cache, no-store, must-revalidate

<- Vary: Cookie, Accept-Language

<- Content-Language: en

<- Date: Mon, 21 Nov 2016 00:27:48 GMT

<- Content-Type: application/json

<- Pragma: no-cache

<- Expires: Sat, 01 Jan 2000 00:00:00 GMT

<- Set-Cookie: csrftoken=oLgx7eQh8uZH1ZWMl53lC2y0JJWQkmwd; expires=Mon, 20-Nov->2017 00:27:48 GMT; Max-Age=31449600; Path=/; Secure

<- Connection: keep-alive

<- Content-Length: 114

<-

Error in init_oauth2.0(self$endpoint, self$app, scope = self$params$scope, :

Bad Request (HTTP 400). Failed to get an access token.

i saw people reporting similar issues with R FB libraries, some of them reported that reverting to an older httr version resolved the issue (due to the current version possibly having some issues with http instead of https requests). i tried both the current version and 1.1.0 with the same results.

R version 3.2.3 (2015-12-10) Platform: x86_64-apple-darwin13.4.0 (64-bit) Running under: OS X 10.11.1 (El Capitan)

locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] instaR_0.2.4 jsonlite_1.1 httr_1.2.1

loaded via a namespace (and not attached): [1] R6_2.1.2 tools_3.2.3 withr_1.0.1 curl_2.2 memoise_1.0.0 Rcpp_0.12.4 >git2r_0.14.0 digest_0.6.9 httpuv_1.3.3 [10] devtools_1.11.1

found some interesting info at https://github.com/hadley/httr/issues/379, but no solution.

any help would be greatly appreciated!

stedogin
  • 61
  • 6

0 Answers0