访问 Twitter 数据 - 使用有效凭证的身份验证失败

Accessing Twitter Data - Failed authentication with valid credentials

我已经从 Spring 的入门指南 - 访问 Twitter 数据 https://spring.io/guides/gs/accessing-twitter/ 下载了代码。

我在 application.properties 中设置了我的凭据并且没有进行任何其他更改。我 运行 应用程序,当它尝试连接到 Twitter 时,它失败并在 ConnectController 第 240 行出现异常:

ResourceAccessException: org.springframework.web.client.ResourceAccessException: I/O error on POST request for "https://api.twitter.com/oauth/request_token":cannot retry due to server authentication, in streaming mode; nested exception is java.net.HttpRetryException: cannot retry due to server authentication, in streaming mode

我已经检查过应用程序正在读取凭据。它们是有效的 - 我使用它们连接我用 twitter4j 编写的另一个应用程序,尽管在那种情况下,除了消费者密钥和消费者秘密之外,我还使用令牌和令牌秘密。

有什么想法吗?

谢谢

我遇到了和你完全一样的问题:这是因为我没有在 Twitter 设置中设置回调 URL。

只需在您的 Twitter 应用程序设置中检查回调字段是否已设置(我使用与网站字段相同的 URL)。