I am having trouble configuring FB login to work with my cordova mobile application.
I have followed this tutorial: http://www.codeproject.com/Tips/1031475/How-to-Integrate-Facebook-Login-into-a-Cordova-App#_comments
<script src="js/angular.js"></script>
<script src="js/ng-cordova.js"></script>
<script src="cordova.js"></script>
I installed ng-cordova and angular using bower. And I put those two javascript files in my www folder along with this code in my index.html
This is what I have in my app.js :
var app = angular.module('myApp', ['ngCordova']);
app.controller("OAuthCtrl", function($scope, $cordovaOauth){
$scope.facebookLogin = function() {
alert("Click");
//user your fb app Id..
$cordovaOauth.facebook("1232456",
["email"]).then(function(result) {
alert(result.access_token);
// results
}, function(error) {
alert("error");
alert(error);
// error
});
}
})
And this in my index.html :
<body data-ng-app="myApp">
<div ng-controller="OAuthCtrl">
<label >
<button class="button button-block button-positive"
ng-click="facebookLogin()">
Login with Facebook
</button>
</label>
</div>
</body>
The program compiles and runs fine. Although the button is not clickable. Any help is appreciated. Did I install angularjs incorrectly? I've followed this tutorial: http://ngcordova.com/docs/install/
As per your code , I can see that you were not install ng-cordova-oauth plugin. you have to install ng-cordova-oauth using bower which also include all dependancy.
Than include in index.html
<script src="lib/ngCordova/dist/ng-cordova.min.js"></script>
<script src="lib/ng-cordova-oauth/dist/ng-cordova-oauth.js"></script>
<script src="cordova.js"></script>
Dependacy include
var app = angular.module('myApp', ['ngCordova','ngCordovaOauth']);
for reference of complete installation use Adding google plus login to ionic app
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.