Grails social plugins for facebook give error response after user authenticate application - facebook

I am new to grails and i am trying to add facebook plugin to my web application. i have successfully(as i believe) installed plugins and addED necessary code in my application. I followed the documentation found at http://splix.github.io/grails-spring-security-facebook/ , when I run my app I see the facebook connect button on gsp page,after clicking on connect button a popup opens up asking for permissions required in app and when user clicks on allow button i receive error "No authentication provider found". I dont know where i am wrong ,can any one help me please.
Thanks in advance

You have custom list of providers:
grails.plugins.springsecurity.providerNames = [ 'myAuthenticationProvider',
'anonymousAuthenticationProvider',
'rememberMeAuthenticationProvider']
And none of them supports FacebookAuthToke, so Spring Security cannot authenticate using Facebook Authentication plugin.
If you really need to have custom provider, just put original provider into this list:
grails.plugins.springsecurity.providerNames = [ 'myAuthenticationProvider',
'facebookAuthProvider',
'anonymousAuthenticationProvider',
'rememberMeAuthenticationProvider']

Related

Spring social SignIn with Facebook not working

I work on an application and i want to add ProviderSignIn features. I place a button on my web page so people could connect ( signin) to my application using facebook. As documentation says (http://docs.spring.io/spring-social/docs/1.0.3.RELEASE/reference/html/signin.html), the oAuth dance :
1. POST is made to signin/facebook work(seen in firebug)
2. GET is made to signin/facebook?code="somecode" work(seen in firebug)
3. GET is made to signin but this just displays my view signin.
The documentation says :
If any error occurs while fetching the access token or while fetching the user's profile data, ProviderSignInController will redirect to the application's sign in URL. The request to the sign in URL will have an "error" query parameter set to "provider" to indicate an error occurred while communicating with the provider. The default sign in URL is "/signin" (relative to the application root), but can be customized by setting the signInUrl property.
At step 3, my url is signin#= and not signin with error query parameter.
I don't understand why i am not getting error in query parameter ?
Just create your own controller which extends ConnectController and implements it's methods. It worked for me.

how to send and receive data between phonegap child browser to main application

I'm working on a Facebook login authentication in a Phonegap child browser. For that externally I have a page that can initiate authentication process and redirects back after authentication (let's say www.mysite.com/Facebook.html). Now I have authentic user from Facebook, but how can I get that authentic user data from child browser to main application and close child browser. for security reason, I set "showLocationBar: false" , so there is no close button.
So, now let me know
how can I get Facebook authenticated user data (user email and access token for further transactions with Facebook) to main application and close child browser.
how to close child browser from child browser as I don't have close button on Child-browser.
is there any way to save data from Facebook to a JavaScript object in my main application
This is my first application with Phonegap, but im experienced with Facebook and JavaScript. So , please let me know if I'm wrong any where.
Thanks in advance,
Looking forward.
I am also using chilldbrowser for Facebook connect. Here is the link for complete source code for Facebook connect using childbrowser: http://www.drewdahlman.com/meusLabs/?p=88. You can get user's name using access_token using the code below:
var params='access_token='+accessToken;
$.get("https://graph.facebook.com/me",params,
function(response){
fbUesrName=response.name;
},"json");
You can close the childbrowser using:
window.plugins.childBrowser.close();
#Venkat : Not sure if you already got the answer for closing child browser from within app. This code worked for me. Put a close button on your site and put the URL as "google.com".From PG app you can write the code below
window.plugins.childBrowser.onLocationChange = function(locationLink){
if (locationLink.indexOf('google.com') > 0) {
window.plugins.childBrowser.close();
}
}

Facebook Connect Problems With Grails

I am trying to use the Grails Facebook Authentication plugin but am running into problem. I have (I believe) successfully installed the plugin, put a facebook connect control on a page, and ran the installation script.
When I click on the Facebook Connect button I am correctly brought to Facebook, where I login correctly. At this point the popup closes and nothing happens. I have a custom FacebookAuthService but no breakpoints inside ever get called. I believe I have either 1) hooked up the Service incorrectly or 2) hosed up my Facebook settings so that I am not getting the information back, but I am not sure how to diagnose the problem.
When I run the app locally, it runs on http://localhost:8080/TestApp
In my Facebook App Settings I have tried using "http://localhost", "http://localhost:8080", and "http://localhost:8080/TestApp" as the Site URL and I have "localhost" as the App Domain. What am I missing?
Here is a link to the GitHub Project (I've changed the fb private key).
Any ideas? Thanks.
Button authorize you only on client side, because of Facebook Javascript SDK. Please reload page after susseccful authization, like:
FB.getLoginStatus(function(response) {
if (typeof(response) == 'undefined') {
return
}
if (response.status == 'connected') {
window.location.reload();
}
})
The JS SDK does not currently have support for non-standard ports in this scenario, but come Tuesday, this will be corrected, and it will once again support it.

iphone how to capture simple login/logout event from web to native

I am developing iPhone application which loads login page of my website. I am able to load my login page using phonegap/childbrowser. I am newbie to JS, Phonegap.
How do my native/phonegap application should handle logout and login event has performed on the webpage? Please guide me how to know user has logged out.
Also is it possible to add support for Push Notification in phonegap/childbrowser application ? How?
So far have seen facebook login-logout questions around but hard to understand and couldnt simulate similar approach.
does your whole app run using the childbrowser? If so why not just have the login log out as piece of your app?
Also if you have to use the childbrowser best bet is to set up a locationchange event and if the location equals a login success page then append some arguments and store those using localstorage.
example -
client_browser.onLocationChange = function(loc){
locationchange(loc);
};
function locationchange(loc){
if(loc.indexOf("http://www.example.com/success?login=true&user=foo") > -1){
var user = loc.match(/user=(.*)$/)[1]; // grab user info
localStorage.setItem('login','true'); // set login as true
localStorage.setItem('user',user); // set username
}
}
that will save to your app locally that the user is logged in and their username, which you can use later if you need to use the childbrowser by passing that in the url you open and on the server side you'll have to look for those arguments.
to log out just open the childbrowser and send a logout argument
www.example.com/logout?user=foo
and in your localStorage
localStorage.setItem('login','false');
Honestly this is kind of a vague question, it would really help to understand why you're wanting to do this in the childBrowser vs your app...

BlackBerry Facebook jar file in eclipse

I know this might sound a very basic question but I am having an issue in using Facebook SDK for Blackberry. I have downloaded the latest one 0.8.25. I have imported them in my eclipse and they are present in the referenced libraries. I have a game app where I want the users to login using their facebook account. Which class contains the code for logging in? Are the jar files implementable or they are just for reference? I have read forums posts where users say that they executed Strawberry program but I can no where find any executable source code. Kindly please let me know how do I create a login page for BlackBerry using its SDK. I did go through another link of Sample Code here!
Let me know which class has login code or how do i use the SDK
At the very basic least, you need to get an instance of the Facebook object and call getCurrentUser(). So, for example:
String[] permissions = new String[] { Facebook.Permissions.ALL_PERMISSIONS };
Facebook fb = Facebook.getInstance(new ApplicationSettings(myNextUrl, myAppId, myAppSecret, permissions));
User fbUser = fb.getCurrentUser();
The code in the library will handle all of the details like getting the user to login to facebook account and accept the requested permissions and so on. You'll want to wrap that all in a try/except to catch FacebookException for error conditions (e.g. user refuses your request).