How to embed facebook / twitter login into my site asynchronously - ajax

I want my site users to be able to login using facebook/ twitter login. I found the code from facebook/twitter developer page. This is working fine. But i wish to implement these code through asynchronous(ajax) request. Something very similar to http://list.ly login window.

Related

facebook login is'nt redirect back properly

Working with Laravel 5.2
Using SammyK/LaravelFacebookSdk
I have an web application witch users can vote in each category once so before they can vote they have to login to facebook everything working fine until it comes to the redirect the user to the page with message like thanks for voting here is the application on the internet Here
Now whenever the user click on vote I get different responses on my PC on
chrome everything working OK
on Firefox and other devices Not working
Whet happens is is the voting done successfully but the redirect back not
it go to this URL
https://www.facebook.com/v2.9/dialog/oauth?client_id=139382809958016&state=d517376c10784f6b5f718112a7c49b83&response_type=code&sdk=php-sdk-5.5.0&redirect_uri=http%3A%2F%2Fsatfestival.net%2Ffacebook%2Fcallback&scope=email%2Cuser_events#_=_
and redirect back to this URL
satfestival.net/facebook/callback/?code=AQApHGQa5LtqLSv75bq8V6QA_6I9ivmKJ07kcO3aYY7pCmSIYoPu8lzrZhRSGYXg7weiOgIa5c1vKDchsbVepn0-LH9rh1kUKgpcJ71DFtYqbZLMLfEYD1DJWmqyqoFS_RL03b2IhZx62LP8NyepCZ0zTn8auxzGN2-jhtZ-YHVFPuGlJI31UnCc7ymhCXu1Zie8hMxp38z5CvPrhE5lDEEQjDgXqz2o45XTsOR3WaJfbEx51yscGx4SFr0Gtl6DKSTXol-3tkqkMZ3JhP7-JXk7RHwj1c3PhDTwXcgc6c8gq4qOMSwaR_EWnZtn8vX5ICc&state=d4e6fd2949abda8f85810e36a4a3fc35#_=_
and again redirect to the first URL and back to the second URL and so on.
Here is a screen shot of the Facebook Client OAuth Settings
if someone like to see the controller I will provide the controller too.

How to display the facebook oauth2 login in a popup?

I followed this tutorial (https://spring.io/guides/tutorials/spring-boot-oauth2/) to create a facebook oauth2 login and it's working fine.
Once I click on the login button it redirects to the facebook page and after the user logs in it goes back to the application.
Now I want to modify the code so I can have a popup instead of redirecting the application to the facebook web page. I'm trying to find some material on how to do that, but couldn't find anything so far.
Does someone know what needs to be done or have some link / article on how to do that?
Thank you!
That has to be done in the javascript front end. From https://developers.facebook.com/docs/reference/javascript/FB.login/v2.12
Calling FB.login() results in the JS SDK attempting to open a popup window.

Laravel Stormpath Social Login Error

I am using Laravel 5.1 and Stormpath for User management.
I followed this documentation to implement google login
Configuring Your Social Provider = DONE
I created project in Google Console and in “Authorized redirect URIs” I've added
https://{DNS-LABEL}.apps.stormpath.io/authorize/callback
Create a Stormpath Social Directory = DONE
Initiate Social Login - In my form when I click on Google Sign In it redirects to
https://{DNS-LABEL}.apps.stormpath.io/?response_type=stormpath_token&
account_store_href=https://api.stormpath.com/v1/directories/{id}
&redirect_uri=https%3A%2F%2Flocalhost
and returns
{"status":404,"message":"Resource not found."}
As per this documentation:
The user clicks on a “Login with Google” link pointing at your application’s /authorize endpoint
Stormpath handles the login to Google and redirects the user back to your app with a Stormpath Token JWT response
What am I doing wrong? Why isn't stormpath redirecting to the google login page?
It looks like the URL that you are creating is missing the /authorize part. If you update your URL to be
https://{DNS-LABEL}.apps.stormpath.io/authorize?response_type=stormpath_token&
account_store_href=https://api.stormpath.com/v1/directories/{id}
&redirect_uri=https%3A%2F%2Flocalhost
It should begin working for you.
In a future release of the PHP SDK (which powers the laravel integration), we will be able to generate this URL for you.
If you are using our Stormpath/Laravel integration, the views provided will automatically handle social logic for you. If you are doing this from scratch, it may be worth a look at https://github.com/stormpath/stormpath-laravel
-Brian

I need an overview of Stormpath and can I use it in my web application?

I am reading the docs in the Stormpath website. They have documentation about how to create account, application...
But I cannot find the overview the big picture of the Stormpath
especially how can my web application can integrate with it.
I need a picture that describe the flow of the authentication between my Web Server, browser, and stormpath API.
I have a web application and a login page.
My specific questions are:
When a user clicks the submit button of the login page, should I call the RestAPI to Stormpath to authenticate or I need to send username and password to my web server, and web server will send it to Stormpath to authenticate?
If when a user clicks the submit button and I need to call the RestAPI of Stormpath from JavaScript, after login successfully do I have a returned Access token? And what can I do with that token.
Please help me.
Heyo -- I work at Stormpath, so hopefully I can explain this for you a bit.
If you're building a website, and storing your users with Stormpath, here's how authentication works:
A user visits your website, and clicks the login page.
You show a login page and collect the user's email and password (or username).
The user clicks Login, and that form data is transferred to your web server (not Stormpath!).
On your server-side code, you would then use one of the Stormpath libraries to authenticate the user's account. You would take the form data the user submitted to your server, and then call the proper Stormpath method to authenticate the user.
Stormpath will log this user in, by creating an access and refresh token, and securely storing cookies for your user in the browser.
This is how the flow typically works.

how to get authorization code to my wp app for google authentication?

In my WP7.5 app, I have redirect the user to google web page where is asked to giving the app permissions to access to his account, user click yes, but it redirects to a page where there is the code and user is supossed to copy/paste that to my app.
The Response is
Please copy this code, switch to your application and paste it there:
4/3oHAHtqSk1CqA3S8HlEsuQRaE08e.4nCBpXhR-R8WgrKXntQAax02U4CwcgI - Auth code
I want to, when user press ok, return to my app with that code, is there any way to do that?
-SheikAbdullah
If you're using the Browser control, here's a great CodeProject article on how to do it:
Google OAuth2 on Windows Phone

Resources