httr github API回调URL问题

httr github API回调URL问题,r,github,github-api,httr,R,Github,Github Api,Httr,我现在也在使用httrv0.2包来使用githubapi。但我正在努力通过oauth2.0(…)部分,在该部分中,我进入应用程序的浏览器页面,单击“允许”,然后重定向到回调URL页面 httrgithub演示建议使用回调URL作为http://localhost:1410但当我被重定向到该页面时,google chrome表示它无法连接到该页面,并且它被重新定向到的页面是http://localhost:1410/?error=redirect_uri_mismatch&state=DZNFcm

我现在也在使用
httr
v0.2包来使用githubapi。但我正在努力通过oauth2.0(…)部分,在该部分中,我进入应用程序的浏览器页面,单击“允许”,然后重定向到回调URL页面

httrgithub演示建议使用回调URL作为
http://localhost:1410
但当我被重定向到该页面时,google chrome表示它无法连接到该页面,并且它被重新定向到的页面是
http://localhost:1410/?error=redirect_uri_mismatch&state=DZNFcm8tnq
…所以我尝试了一系列其他端口和整体URL,但没有成功

另一个回调URL和URL是什么

下面是我使用的代码

require(httr)
## Loading required package: httr
github.app <- oauth_app("github","xxxxx", "xxxxxxxxxxxxxxx")
github.urls <- oauth_endpoint(NULL, "authorize", "access_token",base_url = "https://github.com/login/oauth")
github.token <- oauth2.0_token(github.urls,github.app)
## Loading required package: Rook
## Loading required package: tools
## Loading required package: brew
## starting httpd help server ... done
## Waiting for authentication in browser...
require(httr)
##加载所需包:httr

github.app您是通过web应用程序提供此服务,还是它是一个扩展/插件?重定向url必须与设置github应用程序时指定的回调url来自同一主机。更多信息,请参阅。如果您在扩展中使用API,那么我将不会有太多帮助。当我遇到你的问题时,这就是我想要的

您应该将
httr
软件包更新到最新版本(现在是0.3-在CRAN中提供)。我从
httr
(0.3版)演示中找到了相关示例:

库(httr)
# 1. 查找github的OAuth设置:
#    http://developer.github.com/v3/oauth/
oauth_端点(“github”)
# 2. 在https://github.com/settings/applications
#在下面插入您的值-如果省略了secret,它将在
#GITHUB_CONSUMER_SECRET环境变量。
#
#使用http://localhost:1410 作为回调url

myapp我确实遇到了相同的错误和问题,通过按照演示将主页URL修改为正确的URL解决了问题: 因此,最终问题不在回调URL中,而在主页URL中,您也可以在oauth2.0_token()函数中使用cache=F参数


祝你好运。

我也犯了同样的错误。但在我安装了httpuv包之后,它工作得很好。一旦安装了httpuv包,在运行此代码时


github_令牌非常好。我必须安装并加载httpuv包,才能让它正常工作,但从错误消息来看,它进行得非常顺利?我有同样的问题,这个问题没有公布的解决方案。谢谢。对我来说,回调URL必须设置为“”(不要忘记最后一个反斜杠)。
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 url
myapp <- oauth_app("github", "56b637a5baffac62cad9")

# 3. Get OAuth credentials
github_token <- oauth2.0_token(oauth_endpoints("github"), myapp)

# 4. Use API
req <- GET("https://api.github.com/rate_limit", config(token = github_token))
stop_for_status(req)
content(req)