如何在 facebook API 中使用 httr 包中的 oauth2.0_token 函数?

How to use the oauth2.0_token function from httr package with facebook API?

我有一组依赖于 httr 包的 facebook 函数。

通常的程序是必须设置 oauth 应用规范和 facebook 端点。直到最近,这还像一个魅力,但现在当我尝试通过 oauth2.0_token 函数获取令牌时,我得到了错误:

Waiting for authentication in browser... Press Esc/Ctrl + C to abort Authentication complete. Fejl i init_oauth2.0(self$endpoint, self$app, scope = self$params$scope, : Bad Request (HTTP 400).

你看下面我的代码:

facebook_app <- oauth_app("facebook", key = "XXXX", secret = "YYYY")
  # end point
  facebook_ep <- oauth_endpoint(
    authorize = "https://www.facebook.com/dialog/oauth",
    access = "https://graph.facebook.com/oauth/access_token")
  # token from endpoint and oauth
  fb.token <- oauth2.0_token(facebook_ep, facebook_app, user_params = facebook_ep)

我去过各种帖子和论坛,但我还没有找到解决方案。

通过设置解决:

Sys.setenv("HTTR_SERVER_PORT" = "1410/")