How to authenticate angular single page web application with angular facebook sdk that would work with angular ui router where the $stateProvider would check and remember user facebook status, would redirect to facebook login when user needs to authenticate to access the selected view ? How to save facebook status in angular ui controller and later check if the user status without calling facebook ?
-
where is your code? where exactly are you stuck?andyrandy– andyrandy2016-11-24 16:29:39 +00:00Commented Nov 24, 2016 at 16:29
-
I am stuck how to make angular ui router stateProvider recognize what is the state of a user without needing to get the status or call login from facebook when the user status has already done that already.Jure Fadiga– Jure Fadiga2016-11-25 17:24:33 +00:00Commented Nov 25, 2016 at 17:24
Add a comment
|
1 Answer
Yes you can do that, create app with the view and controller defined for the facebook.
var myApp = angular.module('myApp', ['ui.router'])
myApp.config(function($stateProvider, $urlRouterProvider) {
$urlRouterProvider.when("", "/facebook");
$stateProvider
.state("facebook", {
url: "/facebook",
templateUrl: "facebook.html",
controller: 'facebooktrl'
});
});
You need to use the fbSDK as mentioned in the developers document and configure the redirect url too.
Here is a DEMO application