提问人:Hack-R 提问时间:6/16/2018 更新时间:6/16/2018 访问量:266
在 R 中使用 httr 建立具有 StackOverflow.com 的隐式 Oauth2 流
Using httr in R to establish an implicit Oauth2 flow with StackOverflow.com
问:
我正在尝试通过 StackExchange API 为我在 R 中连接到 StackOverflow 的测试建立“隐式”Oauth2 授权流。
我处于这篇相关文章的情况 #3 中,它指定了如何以与语言无关的方式设置和其他值。redirect_uri
我已执行上述步骤,即在 StackApps.com 上设置应用程序以启用隐式身份验证。
我已经使用库复制了 R 中的链接指令,唯一的主要调整是显然在流程中需要客户端密钥,而不是 StackOverflow 实际需要它。httr
httr
library(httr)
# in the StackApps answer stackoverflow.com was used here.
# that just took me to the landing page.
# the docs use this URI and it gets me closer but
# it just says "Authorizing Application" with a blank page under that
# and it never completes.
end <- oauth_endpoint(authorize = "stackoverflow.com/oauth",
access = "stackoverflow.com/oauth")
client_secret = "secret_code_here"
myapp <- oauth_app("myapp",
key = "12665", # not a secret
secret = client_secret,
redirect_uri="https://stackexchange.com/oauth/login_success")
token <- oauth2.0_token(end,
myapp,
scope=NULL)
#,use_oob=T)
当我运行代码时,浏览器会自动打开并转到 StackOverflow.com。但是,它只是将我带到登录页面,而 Oauth 从未完成。
答: 暂无答案
评论
authorize = "stackoverflow.com/oauth/dialog"
scope
key
client_id
scope
key
client_id
use_oob=T
use_oob=T