One-click Registration - am I missing something here? - facebook

I'm trying to implement a 'one-click' Facebook registration process on my site. I'm getting extremely wound up because on other sites with what I want, they just have a 'Register with FB' button which they click and they're instantly given an account.
But if I go to the FB documentation for Registration its talking about displaying an entire form in an iframe with values prefilled (which none of the other websites seem to need?).
I have a FB Login button, which gave me a popup dialog asking to auth permissions and then I added a registration-url to send them to my registration page if they don't have an account (not sure how FB knows this? I guess it means not authorised?). So then how do I authorise the app with one click on the registration page?
All I want to do is initiate a request on my server to make the registration using the FB user's email and user_id. I can store these in MySQL.
Click Register > Authorise app. Whenever you want to log into the system you just click Login (saving you entering an email and password for registering and logging in).
Am I missing something? I can't seem to see this anywhere?
I can't understand what I'm missing here.

use php sdk to access the users info after the dialog. something like below, but probally want to check database for exists.
$email=$user_profile[email];
$uid=$user_profile[id];
$sql = 'INSERT INTO mydatabase (`id`, `email`) VALUES (\''.$uid.'\', \''.$email.'\');';
$insert=mysql_query($sql) or die ('Error! in Insert '.$uid.' SQL');

Related

pyrocms social module: how to register new user with facebook connect

I'm still new to CI and PyroCMS, and am trying to implement a Facebook login using the Social module in a custom module, which looks like it does everything I want, but I'm clearly missing some basics (I can't find any documentation other than the brief readme)!
So far, I've watched the intro video, and have enabled Facebook successfully. I can connect via FB and see FB listed in /social/linked, but some confusion exists in my mind between the two user groups I've got: admin and user.
The flow I'm trying to construct is:
user arrives at the site and is presented with a survey
user fills in the survey, then is asked to signup (I understand that this is unconventional)
/signup has a facebook connect button, supplied by the social module
user clicks the connect button, and grants permission in facebook's popup window
user should be directed back to /signup, (or maybe redirected to /user/registration) with some details filled in from facebook (eg. email, name)
on submit, user should be added to the users table, as a member of the 'users' group (not admin) with no email activation required
an email is sent, thanks page is displayed
on returning to the site, the user should access their on-site profile using facebook connect.
I've read a bunch of threads on the subject, which have shaped these expectations...
Here's where I'm at:
user arrives, fills in survey, clicks the connect button
user is redirected to the homepage, which displays a standard page (not handled by my module). I need to return to /signup!
Based on this, I've tried setting:
$this->session->set_userdata('redirect_to', '/signup');
in what I believe is the correct controller method (checks to see if the user is logged in before sending the email, then calls template build to display the social buttons), to no avail.
(edit: I now see that the code above relates to the user module, not the social module.. maybe i can transplant some changes...)
My questions:
am i on the right track, or going about this the wrong way?!
am i right in thinking that the FB account will be matched with an existing user if the email addresss exists in the system?
I have only one FB account, which I is authorised for the app, and I'm using to connect with as a user - will this work, or do I need a separate FB account to test as user?
Other notes:
I am testing the site in Chrome, logged in as admin in Firefox.
Facebook is my testcase, I'm looking at supporting FB, LinkedIn, google and Twitter eventually.
Phew! Grateful for any feedback, Tim
I will try to answer some of your questions since i'm currently experimenting with the exact same social module as well and with some addons to it.
am i right in thinking that the FB account will be matched with an
existing user if the email addresss exists in the system?
Yes you are. I checked it myself while troubleshooting the fact that my google (gmail address) could'nt connect while my hotmail (registered email) could. You will have to sync your emails in all your social sites, change the loginsystem (allowing username login for example) or manually connect multiple emails in your account settings..
I have only one FB account, which I is authorised for the app, and I'm using to connect with as a user - will this work, or do I need a separate FB account to test as user?
I suggest u let someone with another FB account test the system (better save then sorry) but in my case I didn't have any troubles using other (normal) accounts to log in.
am i on the right track, or going about this the wrong way?!
This was your first question, but I'll answer this as the last on since I didn't test is myself:
The Facebook App has a setting called "Site URL". This is the url to which will be redirected. Simply change it to the page you wish it to be. You can also try to change the following lines in social/controllers/social.php:
Line 245 (redirect: user is logged in after FB connect)
redirect($this->input->get('success_url') ? $this->input->get('success_url') : 'social/linked');
Line 283 (redirect: user has to fill in some additional fields to complete registration)
redirect('users/register');
Good luck!
The intro video shows off the entire extent of the social module. Frontend registrations, frontend user account linking, and backend account linking for the entire system.
If you wish to integrate custom functionality, custom user flows and other stuff as listed in your question then you will need to do a little custom work with the module. Hack it, extend it, send in some pull requests, whatever, but sadly it cannot do "everything to integrate with everywhere ever" out of the box. :-/

ASP Classic: twitter and facebook autoposting without signing in

In work I got a task (we MUST work with ASP Classic by the way): when user posts a blog, a link to that blog should be posted automatically on user's facebook timeline and in his twitter. I made everything working, but there is one problem: user needs to be signed in to post. I've made the cheking if he's logged in, and if not he must log in.
But I need to avoid the logging-in step and make it automatic (by sending user's username and password as part of the data sent to twitter/facebook or something like that), but I can't figure out how to do that or if it's even possible at all.
Any ideas? Would greatly appreciate any help.
P.S.: for the twitter part I used http://scottdesapio.com/VBScriptOAuth/
for the facebook part I used a combination of: http://snipplr.com/view/61108/facebook-app-login--authorization-entirely-clientside/
Everything works, but is it possible to automatize the user's sign-in part?
Finally I managed to make the both things automated...
The problem with Twitter was that I didn't store request token in session, that's why I got "Could not authenticate you" error.
Can't remember what I did wrong with Facebook (some co-workers helped me out), but I guess I didn't make proper http requests...
So the answer is: yes, it is possible to automatically post to Twitter and Facebook without user sign in.
If I am not wrong then your logged in user in facebook for current browser is not authorize for your app.
I think you should try googling about "How to authorize users into app". OR
If you don't mind I am giving you the direct URL to go to that setting page for your app:
https://developers.facebook.com/apps and then go to your app then after from left side bar go to roles and then after click on test user tab from top of page and then click on add button it will opne one pop-up to add a user.
In app you have to add test user for testing purpose and have to login for that added test user, so added user will be authorize for that app and you will be able to test.
Thank you...

Facebook connect - How To

I have a website and I want users to register and login via Facebook connect. What I can't find out is how to FORCE a registration before logging in. I need all users in my database but it's possible to click the Facebook Login button without registering... I just don't get it, how do I FORCE a registration? Is there any good example on this?
Thanks for your help.
When you say you need all users in your database, what exactly do you mean?
With the facebook login button, you can still supply a redirect url after they authenticate for the first time and you can then capture their user_id, or potentially forward them to another page that has your own registration form. You could then have a flag in your database that indicates if they are a confirmed user (much like when you send email confirmations) that only gets set to true once they have submitted your extra form.
Check this flag on page load and forward them to your form if they haven't entered those details. Then control access to your site based on that flag.
Or are you saying you're trying to use the registration plugin https://developers.facebook.com/docs/plugins/registration/ but that isn't working correctly?

Facebook account to replace registration?

I'm new to all this. This is what i'm after and i'm sure it's possible.
I've got a script where people can register/login in to as members. What i'd like to do is tie it in so that it just uses Facebook users details for the registrations. I've managed to set it up to sign up and and complete a registration using a user's name and email.
What i'd like to do now is automatically log the user in if they're logged in on facebook, is this possible or will they need to click a login button that then takes them to their page? If they need to click a button to login, how do I go about getting the button to take their facebook details and log them in? Also what happens in regards to passwords on my site? Is that stored in the app somehow?
Ideally i'd like to use the popup version of verification rather than the iframe that i've got set up at the moment.
Cheers in advanced for any help for a n00b!
This is in fact possible. Although I for my part was never a fan of such things here's some human-readable (simplified) theory:
Facebook uses a system called OAuth ( http://de.wikipedia.org/wiki/OAuth ). That means, when you want to have the user login onto your site using Facebook you'll of course need to provide a button/facebook-login-frame (see documentation) that says "Log me in with Facebook" or so. You then access Facebooks API (more here: https://developers.facebook.com/ ) and basically tell Facebook who you are ("Hi I'm website XY"). While that happens your user is redirected to Facebooks "permission-landing-page". On that page he needs to confirm whether he is fine with your website accessing certain information (like his name). If he confirms your website receives an access-token granting you access to a subset of his user information which you can then use to personalize his expeirence on your website.
Check out facebooks documentation because they explain exactly your usecase in detail.
(here: https://developers.facebook.com/docs/authentication/ )
PS: You'll of course never have any access to his Facebook login/password. That's kind of the idea behind "delegating" the authentication via OAuth to Facebook. Facebook only provides you with an access token (bound to that particular user who logged in and granted your app/website permissions)

Authenticate to Facebook without Clicking Facebook Connect Button

I have added Facebook Connect to my application via the JavaScript SDK. I'm using Spring Security (this is a grails app) and I have added code that when someone clicks the FB Connection button to login, I manually authenticate them against their user account and everything gets wired up appropriately. I have 2 questions:
When a user first logs in with FB and I don't have an account for them, I create an account for them with their FB info, generate a random password, and use their email for their login name. If the user then uses the regular login form instead of the FB button to sign in, how do I sign them in to FB as well?
Every time the user clicks the FB Connect button, the popup window shows up. If they are already authenticated, it just goes away and then my web site redirects correctly. How do I keep the popup window from showing up in this case?
Thanks
To you first question, the user might be connect on Facebook when landing on your page after registration. So you can rely on the Javascript SDK to help you out.
See here: http://developers.facebook.com/docs/reference/javascript/FB.getLoginStatus
To your second question, I think you can't, except you might get a work around if you use the Javascript SDK mentioned for the first question!
This is how I did it for moviezine.se and it works just fine, but it might be a little irritating to be logged in without asking for it when you come back a few days later. Then there is the use case of the logout: if you are automatically logged in, are you automatically logged out too; and if not, what if your Facebook session is replaced by your girlfriend's one who is also a user on your site! :)