Grails: spring-security-facebook plugin and login page integration - facebook

I have been trying out the spring-security-facebook plugin and so far its been smooth. I am able to use the facebook login button and have also created the FacebookAuthService for some custom processing - in creating my own user object and associating it with the facebook domain object.
However, what I want to do is integrate the button with the auth.gsp provided by spring-ui. I was able to take the first step in this and the button now appears along with the regular login form. However, on clicking on the FB login button, I want the workflow to be the same as that of the regular spring flow.
Are there any pointers for this?
I assume I will need to stop using the facebookAuth:connect tag and instead build this part of the flow using javascript - but how do I get the logged in user now connected to spring so that on clicking the FB button, the page then goes to the page that I was earlier trying to access before spring security redirected me to the auth page?
Any directions for this would be much appreciated, thanks.

Spring-Security-Facebok plugin uses cookies provided by Facebook (set by JS SDK after auth). I mean there is two steps: first step is when user is logged into app on client side (done by javascript), and second when page is reloaded and server login user on server side too.
Probably you can make your own Javascript event listener on 'auth.login', and redirect to requred page. User will be authenticated at this point.

Related

Any experience with cypress-social-login using Facebook provider?

I am trying to make an automated test of the Facebook login feature in our web application in Cypress. I would like to skip the visual input of credentials and rather provide them programatically.
I came across the cypress-social-login plugin - https://www.npmjs.com/package/cypress-social-logins
Does anyone have the experience specifically with the implementation of this plugin for Facebook login? Or did anyone manage to automate Facebook login without any plugin?
Another question is: for the plugin to work, I have to provide a login url fom my application. But my application doesn´t have a specific login url. It uses a fullscreen modal that contains a Facebook login button. Is there a way to modify the plugin to deal with this?
Meanwhile I accepted this fact. But I was successful by using another much simpler approach: First I go to facebook.com and log in there. Then I open my App and click the Facebook login button. In this way I can simulate the majority of users that are already signed in.
Unfortunately, when I run the tests on Lambdatest, Facebook won´t let me sign-in and tells me that I am misusing their services by going too fast :D
For now I am left by running tests locally.

Implementing facebook feed dialog and cross domain environment

I'm trying to implement a Facebook Share widget which will be a link(button) on a client's page. When user clicks on "share" button, dialog will show up, populated with the information(caption, description, etc.) received from our server.
I've tried using Feed Dialog to accomplish this task.
I've gone as far as: - registering my application with Facebook and getting my application ID. - placing feed dialog code onto the test page which is currently located on my local machine.
So, currently my application points to localhost url.
Everything works as expected as Site Url and App domain are set to my local machine url. However, for our purposes we need to trigger this dialog from many different client's pages. So, those URLs will always be different.
I was thinking to use https://www.facebook.com/sharer/sharer.php however, as far as I know it doesn't have a callback function which we also need to have.
Do you have any advise on how this can be implemented?

Facebook connect, auto prompt for login

I have added a login button to my site anad added scope to publish actions as per guide i found here: developers.facebook.com/docs/reference/plugins/login/ and this works fine but my question is: How can i have same function but this prompt to show to users without needing to click on the Login Button.
If user has not installed app, he would be prompted automatically to install it.
Thanks for any help.
Use FB.getLoginStatus of the JavaScript SDK to see if you have a user connected to your app visiting your page. If not, redirect them to the server-side auth dialog (using client-side auth would not be a good idea, since most browsers will block a popup that’s opened without any actual user interaction).

How to become redirected to Facebook's Mobile Web URL

I would like to integrate an existing, external application with Facebook using Mobile Web method and its authenticated referrals as well as to be able to redirect user (incoming from a different place) to Facebook login page. I do not want it to be embedded in Facebook page.
If I understand correctly how the authenticated referrals work, I must somehow reach the authentication dialog which will redirect me to the Mobile Web URL, which I specified in the application configuration.
Additional information: I would like to avoid making the application public until it is ready, so I have set the Sandbox Mode setting to Enabled.
How to get the URL, with which I will be able to test authenticated referrals?
You can land at your game's Mobile Web URL page using following steps:
Switch your user agent to iPhone or other mobile.
Go to the http://m.facebook.com page.
Press the "identity" icon in the top left edge of the screen to show the bookmarks menu.
Look for the application in the Apps section.
Press the application bookmark.
Above procedure worked for me. My user was an admin of the project but it will probably work also for devs and testers (just a guess).

GWT - Refresh page Issues when I clicked on Broswers Refresh/reload button

When I am login in GWT Application, it will open my dashboard but when I am click on browsers refresh/reload button it will call entry point of my application and it will load my login page.
So how can I stop this issue.
How can I stay at same page when I am click on Browsers refresh button?
You can save user info in session after logging in and check it in your entry point class before calling login form/method and than decide to show login form or not.
But I think, the better way is not to write login logic by hands, but to integrate spring-security to your gwt application. It will do all logic by itself, you need only to create login page (you can write login page not in gwt) and make it work with gwt.
Spend week if needed to understand how it works and you will have no problems in future.