httr github-API callback URL issues httr github-API callback URL issues r r

httr github-API callback URL issues


You should update httr package to latest version (now it's 0.3 - available in CRAN). I found the relevant example from httr (version 0.3) demos:

library(httr)# 1. Find OAuth settings for github:#    http://developer.github.com/v3/oauth/oauth_endpoints("github")# 2. Register an application at https://github.com/settings/applications#    Insert your values below - if secret is omitted, it will look it up in#    the GITHUB_CONSUMER_SECRET environmental variable.##    Use http://localhost:1410 as the callback urlmyapp <- oauth_app("github", "56b637a5baffac62cad9")# 3. Get OAuth credentialsgithub_token <- oauth2.0_token(oauth_endpoints("github"), myapp)# 4. Use APIreq <- GET("https://api.github.com/rate_limit", config(token = github_token))stop_for_status(req)content(req)

You can get it with demo("oauth2-github", package = "httr", ask = FALSE) command.


Are you serving this from a web app or is it an extension/plugin? The redirect url has to be from the same host as the callback url you specified when you set up the github application. See here for more. If you are using the API in an extension then I won't be of much help. That's what I was looking for when I came across your question.


I had the same error and problem exactly and the problem was solved by modifying the Homepage URL to the correct one as per the demo : http://github.com so eventually the problem was not in the callback URL it was in the Homepage URL, you might also use the cache=F argument in the oauth2.0_token() function.

good luck.