Grails Spring Security Facebook Plugin not Working - facebook

I am trying to use spring security facebook plugin in grails. Here is my configuaration
BuildConfig.groovy:
compile ":spring-security-core:2.0-RC2"
compile ":spring-security-facebook:0.15.2-CORE2"
Config.groovy:
grails.plugins.springsecurity.facebook.domain.classname='com.spring.grails.loginapp.domains.auth.FacebookUser'
grails.plugins.springsecurity.facebook.appId='711430758877160'
grails.plugins.springsecurity.facebook.secret= *****
grails.plugins.springsecurity.facebook.autoCreate.enabled=true
grails.plugins.springsecurity.facebook.autoCreate.roles=['ROLE_USER', 'ROLE_FACEBOOK']
I created domin using s2-init-facebook. I created Login with facebook in my GSP.
But When I try to click Login With Facebook, I got Invalid app id error.
Invalid App ID: Invalid
When I go to http://graph.facebook.com/645351175512630 to verify my App it seems to be correct.
I Followed documentation of grails spring security facebook plugin.

First of all, you have to put configuration into Config.groovy. BuildConfig is used for dependencies.
Second, as you're using Spring Security Core version 2.x, then correct config prefix is grails.plugin.springsecurity (not grails.plugins.springsecurity, without s)

Related

Spring Boot Admin Server redirecting to login.html after successful login

i have a problem setting up a Spring Boot Admin Server. After setting up a project as described here (note that I am using Spring Boot Version 1.5.19 and Spring Boot Admin Version 1.5.7) I can successfully access http://localhost:8000/login.html. The login ui is shown as well. After I type in the username and password the server redirects me to http://localhost:8000/login.html instead of directing me to the homepage. Solutions found in this Question do not work for me.
I have setup a GitHub project that reproduces this behaviour. It can be found following this link.

logout api error - Rest Spring Security Plugin in Grails

I have integrated REST Spring Security plugin in a Grails app. Login works fine, and returns the correct access token. I can call other actions with this Authentication Token in X-Auth-Token in header.
I'm using Grails 2.4.4, and spring-security-rest plugin 1.4.0 with JDK 1.6.
However, the logout isn't working and throws Exception:
org.springframework.dao.DataAccessResourceFailureException: Could not
obtain current Hibernate Session; nested exception is
org.hibernate.HibernateException: No Session found for current
thread at
org.codehaus.groovy.grails.orm.hibernate.GrailsHibernateTemplate.getSession(GrailsHibernateTemplate.java:210)
I have tried to upgrade to 1.4.1, 1.5.0 but they seem to be dependent on JDK 1.7 version.
It is a known issue: https://github.com/alvarosanchez/grails-spring-security-rest/issues/135
It was fixed in the 1.4.1 release. You will have to upgrade to that version.

grails spring secuirity ui without mail field on User domain class

In my Grails project I'm using the spring security plugins, that are core, ui and acl.
They works well together but I have a problem with forgot password functionality. Infact, when I try to recover password (/register/forgotPassword path), I have the following exception:
No such property: email for class: medicalofficemanager.SecUser
Possible solutions: all
Is it possible to create automatically the field email for the SecUser domain class, with some command in console, or do I need to create it manually?
For your information, versions currently used are (installed in proper plugin window in Intellij Idea IDE):
Grails 2.2.1
Spring security core: 2.0 RC2
Spring security acl: 2.0 RC1
Spring security ui: 1.0 RC1
Not familiar with the ACL plugin, but pretty sure there's no console command to add an email field. Just add it manually.

Grails Facebook-Graph Plugin Oauth2

We have been using the Grails Facebook-graph plugin for a while now - it has been working perfectly until earlier this month when FB apparently turned off their old authentication scheme, and indirectly forced everybody to use oauth2 instead.
This post from FB https://developers.facebook.com/blog/post/525/ describes the changes, and the issue in the Grails plugin seems to be that it does not comply with the new standard.
The main issue appears to be in the way the active user data is being maintained in the plugin. This is currently based on the FB provided cookie "fbs", which contains all the necessary session data related to the active user. Unfortunately, this is no longer provided by FB (apparently replaced by a "fbsr" cookie instead).
I have searched the FB documentation, and in various forums for details on how to upgrade the plugin, but unfortunately without luck.
Can anyone help with a hint or two on what steps should be performed in order to get the plugin updated?
EDIT: I think the updated version of the plugin (0.14) has been pushed the public repository. You should try grabbing that one first before reading the rest of my answer.
It looks like the plugin maintainer, Jesus Lanchas, made some updates over the last few days to enable oauth2 support. It has not been pushed to the plugin repository yet, but I was able to get it working with my project. Here's what I did:
#Install a local copy of the plugin WITHIN my project
mkdir plugins-local
cd plugins-local
git clone git://github.com/chechu/grails-facebook-graph.git
mv grails-facebook-graph facebook-graph
Update BuildConfig.groovy and tell grails where to load the plugin from. I put this line before grails.project.dependency.resolution
grails.plugin.location.'facebook-graph' = "plugins-local/facebook-graph"
Uninstall the existing facebook-graph plugin from my project
grails uninstall-plugin facebook graph
This is a temporary solution for me until the offical update hits the repo, but it allows me to make sure I'm using the same new code everywhere.
EDIT: we released our Facebook Grails SDK on GitHub :
https://github.com/benorama/facebook-grails-sdk.
Currently only tested on Grails 2.0…
Any feedback is welcome before we release it officially to Grails.org.
Indeed, it looks like Grails Facebook-graph plugin does not support OAuth2 Facebook authentication (which is required since October 1st 2011).
We have already ported the official PHP SDK V3.1.1 to ColdFusion 9 (https://github.com/affinitiz/facebook-cf-sdk).
Last month, we started to implement it as a plugin in Grails 2.0.
It is currently at an alpha stage so we have not released it yet, but it is working on our prototype.
To connect to the Facebook Graph API, it uses RestFB internally.
If you want to give it a try and give us some feedbacks, let me know, I'll sent it to you by email.

Check if facebook oauth 2.0 october 1st migration is done

I'm using facebook connect on a website, it worked well with PHP SDK 3.0.1.
Now I've downloaded and started using PHP SDK v.3.1.1 and set Encrypted Access Token to enabled. It still works without problems. Is this enough for the migration? How can I check it? I don't use the js sdk.
According to the migration guide, it looks like you have done all the steps you need for Facebook on an external website by upgrading to 3.1.1 PHP SDK and set encrypted access token.
If you were hosting a fan page or app inside Facebook you would also need an SSL certificate. And there are several code changes required if you are using the javascript SDK which you say you aren't.