我有一个使用Instagram API的Shiny应用程序,需要一个访问令牌。在本地运行时,我可以使用
full_url <-oauth_callback()
full_url <- gsub("(.*localhost:[0-9]{1,5}/).*", x=full_url, replacement="\\1")
print(full_url)
获取回调网址以注册Instagram。部署应用程序后,如何获取此URL?
此外,这可能是相关的,当部署应用程序时,我收到错误:
Error : oauth_listener() needs an interactive environment
我从未明确使用oauth_listener(),因此我不确定如何抵消这一点。我所有与oauth相关的代码如下:
instagram <- oauth_endpoint(
authorize="https://api.instagram.com/oauth/authorize",
access="https://api.instagram.com/oauth/access_token",)
my_app <- oauth_app(app_name, client_id, client_secret)
ig_oauth <- oauth2.0_token(instagram, my_app, scope="basic", type="application/x-www-form-urlencoded", cache=FALSE)