我正在尝试编写一个 Android 应用程序以使用 OAuth 从 Elgg 获取信息。我正在关注本教程,其代码可在此处获得。
检索请求令牌时遇到问题。我正在使用路标库。我的应用程序中的以下语句引发异常:
// consumer is of type : oauth.signpost.OAuthConsumer
// provider is of type : oauth.signpost.OAuthProvider
String url = provider.retrieveRequestToken(consumer, "elgg://oauth");
例外是:
Request token or token secret not set in server reply.
The service provider you use is probably buggy.
消费者构造为:
consumer = new CommonsHttpOAuthConsumer("<some_key>", "<some_secret>");
提供者被构造为:
String BASE_URL = "http://<ip-address>:80/elgg" ;
String REQUEST_URL = BASE_URL + "/pg/oauth/requesttoken";
String ACCESS_URL = BASE_URL + "/pg/oauth/accesstoken";
String AUTHORIZE_URL = BASE_URL + "/pg/oauth/authorize";
provider = new CommonsHttpOAuthProvider(REQUEST_URL, ACCESS_URL, AUTHORIZE_URL);
我发现这个问题贴在这里,但没有答案。
有谁知道如何解决这个问题?
我想知道它是否与此页面中的以下句子有关:
Using your Consumer -
You use the consumer just as you would any other OAuth consumer.
The plugin works by hooking into the PAM system within Elgg and
validating OAuth credentials, if they exist on the query.
我是否需要为 Elgg 添加任何额外的 PAM 插件,比如这个(它的版本似乎已经过时)?
编辑:
我确实在 Elgg 中安装了URL Getter插件,OAuth 插件依赖于该插件。