【发布时间】:2012-07-23 21:55:20
【问题描述】:
我在我的 Android 应用中使用 LinkedIn OAuth。我已经有一个 LinkedIn 应用程序、消费者密钥和秘密,因此我可以成功请求。
在回调之前一切都很好。网页没有回调,我的意思是onNewIntent 或onResume 方法没有调用。网页只显示带有参数的回调 url。我的意思是它看起来像:
callback_url://?oauth_token=324sdf&oath_verifier=as21dsf
这是我的所有代码:
try {
consumer = new CommonsHttpOAuthConsumer("ConsumerKey", "ConsumerSecret");
provider = new CommonsHttpOAuthProvider("https://api.linkedin.com/uas/oauth/requestToken", "https://api.linkedin.com/uas/oauth/accessToken", "https://api.linkedin.com/uas/oauth/authorize");
final String url = provider.retrieveRequestToken(consumer, Constants.OAUTH_CALLBACK_URL);
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)).setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_FROM_BACKGROUND);
startActivity(intent);
} catch (Exception e) {
e.printStackTrace();
}
活动已在Manifest 中定义为singleInstance。
出了什么问题或遗漏了什么?
【问题讨论】: