Twitter从PhoneGap应用程序登录

时间:2016-08-18 13:03:41

标签: android ios cordova twitter phonegap-plugins

我想为我的PhoneGap应用程序实现Twitter登录 我搜索了一些可用于PhoneGap的Twitter插件,但没有任何东西符合我的要求。

作为官方PhoneGap插件列出的Twitter插件需要在Fabric上创建帐户,这是我不喜欢的。 https://github.com/ManifestWebDesign/twitter-connect-plugin

另外一种方法建议使用inAppBrowser: http://www.oodlestechnologies.com/blogs/Twitter-integration-on-PhoneGap-using-ChildBrowser-and-OAuth-for-iOS-and-Android-Platforms

我们需要具有此HTML页面依赖关系,并且还不太清楚它是如何工作的。 (上面的链接提供了有关使用ChildBrowser的详细信息,但我不知道如何使用inAppBrowser更改它)

在下面的插件中,它仅支持iOS而不支持Android:
https://github.com/etiennea/phonegap-twitter-plugin

基本上,使用Twitter为基于PhoneGap的应用程序提供登录的最佳方式是什么,该应用程序的目标是在iOS和Android平台上运行。

1 个答案:

答案 0 :(得分:0)

  

如果您使用Cordova,请使用$ cordovaOauth进行社交登录

请参阅我的帖子的回答Here以获得一步一步的解决方案。我使用了$cordovaOauth plugin,它对我有用。

$scope.twitterLogin = function () {
$cordovaOauth.twitter("6VjHDXXXXXXXXXXXX", "erN45XbC3b35XXXXXXXXXXXX").then(function (result) {
    alert(JSON.stringify(result));
}, function (error) {
    alert(JSON.stringify(error));
});

}