I've been working with the Facebook JavaScript SDK recently for user signups, I've noticed if I use the system to login to an existing Facebook account it works fine but if I have to create a Facebook account it fails. I realise I'm a bit sparse on details here but I noticed it also fails on the Spotify website, is it even possible to use the JavaScript SDK for signups if the user doesn't have a Facebook account and has to create one? I realise if you don't have a Facebook account already you're unlikely to want to use that functionality but just wanted to see if it really doesn't work in that scenario? Or if it's just me and Spotify not implementing it right.
You can create the Facebook account then click the signup button on my website again and login with your now existing Facebook account and that will work fine, it just involved having to click the button a second time.
Related
I want to create a web application that allows the users to upload videos to a specific YouTube account. The users do not have gmail accounts and they have to access YouTube via one login. Is there a way for me to achieve this without having the users to login to the Google account.
I have tried the samples provided by the YouTube API. These first show the Google+ log in screen for the users to enter the credentials. What i want, is for the application to login, without the users knowing it. Is it possible to implement a way for the application to signin to the account without its users realizing it. Please provide me with a soution. So far I have tried the YouTube JavaScript API.
Thank you in advance!
YouTube is dependent on gmail emails now. They switched a while back.
You should be able to have them login once, and then your application could remember their login.
YouTube's authentication is going to need them to login so the OAuth token can be handed off.
I am new to stackoverflow, so I hope that I ask the question correctly.
For a website that I am working on, I have to implement login in using your facebook account. I have this working for the biggest part, since the user is able to login with using facebook and I'm able to retrieve the information I want.
But the problem is, whenever the user logs in with their facebook account, he automatically gets logged in into facebook itself. And whenever the user presses the log out button, facebook logs him out too. For the facebook login, I am using the javascript sdk from facebook.
This can be quit anoying for the user, since it must be possible for a random user to login my website using their facebook account, even when someone else is logged into facebook itself on the same computer.
So my question is: is it possible to login with facebook, without the user actually login into facebook, like just let facebook verify the account and send the requested information back? Using the facebook js sdk off course.
That is not possible. You cannot have 2 different Facebook sessions in one browser and you need to login to Facebook in order to login to your App.
This question already has answers here:
Get user basic information using facebook Login button plugin?
(4 answers)
Closed 9 years ago.
I have a web app where I'd like to let the user log in with Facebook, not only to support Facebook Comment threads, but to allow me to pre-populate a form the user fills out. (For example, I ask the user to fill out a from that includes fields for their name and birthday; if they're logged in from Facebook, I'd like those fields to be filled in for them already.)
My app is written in PHP. I see that Facebook suggests using the pure-Javsascript SDK (https://developers.facebook.com/docs/facebook-login/login-flow-for-web/). I see the steps to log in the user and confirm their identity, but once they're logged in, how do I get their user data to pre-populate my form? Do I keep a copy in my local database, or do I just ask Facebook for that info every time the user comes to the form?
I don't need perfect code as the answer here-- I'm just looking for some steps in the right direction. What pieces of the SDK do I need to put together? What will my PHP code be responsible for vs. what Facebook's SDK does for me already?
You can proceed like this-
Create an app, add Javascript SDK, add login code. Refer here.
Modify the login code a bit. Replace FB.login() with -
FB.login({scope: 'email, user_birthday'});
Not every details can be fetched by default, but only the basic info. For other info you have to add permissions in your code (as I've mentioned) that user will authorize. To see the list of the permissions, go here and click on button Get Access Token
After the user authorizes your app, testAPI() function is called. So after success, your code will start from here; where you can add the code to fill the details on the form automatically
You do not require to keep any database. After successful login, simply make the API calls to fetch any required details and set the text of the fields of your form. For eg:
FB.api('/me', function(response)
{
alert(response.name);
alert(response.birthday);
});
You can use the Graph API Explorer to test the API results.
I would suggest you to read the basics from the Developer's Site and follow these simple steps, its not so complicated.
I am successful in implementing Facebook API and Google+ API. I don't haven any issues with login or logout. Even when page is refreshed information is working fine.
But when user logs into Google+ and Facebook in different tabs and he provided access to the app by login with both accounts then I am seeing both images.
How can I avoid this. On page load, I would like to see only either Facebook or Google+ but not both.
If Facebook login then show only Facebook
If Google+ Login then show only Google
If he is logged in to both then show only one of them.
This just out, how to do both:
One of the key parts is the concept of identities vs users. A user represents a human, an identity represents a human logging in with a particular social network. Data security is done on users, showing photos and whatnot is done on identities.
The first code snippet shows some pretty simple logic for deciding which login provider to use if a user is logged in with both.
https://developers.google.com/+/best-practices/facebook#separating_social_and_business_logic
Only allow them to associate their Google+ or Facebook accounts, not both. If one is associated, then do not allow the other.
I want to implement something similar to what Digg has done.
When the user logs in for the first time, I want it to force them to create an account on my site.
More importantly I want to know how to log a user into my site when they login with facebook connect. If they login with facebook connect, they still haven't provided me the password to their account on my site, so I can't use username/password to log them into my site. How do they do this on Digg or sites similar to this?
Facebook's process flow can definitely be a bit confusing. Take a step back from the details and the API, and look at the overall flow here:
Facebook Connect will tell you that a user is logged into Facebook, and give you their Facebook ID. You can validate that ID against Facebook using Facebook Connect to make sure it is properly logged in. Once this is done, you don't need a user name and password. As long as you trust that Facebook has authenticated the person properly, they are the only ones that can come to your site using that Facebook ID. That is enough information to start an authenticated session based around a local account that is associated with that ID.
The process you should follow is like this:
User logs in to your site with
Facebook Connect for the first time
You notice that you don't have a local account associated with that
Facebook ID, and prompt them to
enter local account information
You save that information along with their Facebook ID
The next time you see that Facebook ID (and validate that it is
logged into Facebook using the
Facebook API), you can start up a
local session using the associated
account.
Basically you end up with two separate methods of authentication: a Facebook Connect ID check, or the regular username/password login on your site. Either one should have the end result of starting a local authenticated session.
Hope that helps.