possible to logon to forum with facebook account? - Posted (1557 Views)
Junior Member
pierretopping
Posts: 224
224
Just looking at a local website forum that's not snitz (silly them...), and I notice you have the option to logon using a facebook account? Anybody every tried this with snitz, can it be done?
http://oldmerthyr1.proboards.com/index.cgi

Thanks,

Pierre
 Sort direction, for dates DESC means newest first  
 Page size 
Posted
Average Member
Webbo
Posts: 982
982
I think that is using Windows Live log-in

How to incorporate it into Snitz, I haven't a clue

Edit: more info here: https://msm.live.com/app/default.aspx
Posted
Junior Member
golfmann
Posts: 450
450
Facebook:
600,000 accounts "compromised" a day and you want them to get into your forum?
I'll pass. smile
Posted
Junior Member
pierretopping
Posts: 224
224
Thanks all for your thoughts :-)
Posted
Snitz Forums Admin
RichardKinser
Posts: 16655
16655
I absolutely hate all the things that are going to requiring (or have it as an option) a facebook account to login. A lot of iOS apps are going this way unfortunately.
Posted
Junior Member
balexandre
Posts: 418
418
you can easily integrate the Login with Facebook.
Facebook uses OAuth 2.0 so it's very easy to follow up the OAuth rules and implement such, you will need one more field in the users table to hold the authentication token to provided you with "Who are you?" and then auto login with the normal user.
I do that in some of my web apps, though I don't do it on my Snitz Forum as I only have one and though they are more than 250 users that "liked" our page, I don't think that would be a great feature as the age of my forum users are normally 40+

Posted
Junior Member
pierretopping
Posts: 224
224
Is this it I wonder?
http://developers.facebook.com/docs/plugins/registration/
Posted
Junior Member
balexandre
Posts: 418
418
That's just one social plugin, a "ready-to-use" tool if you want information to fill up automatically if user is already signed up in Facebook.
you would only need the Facebook Connect button and request the permissions you need, or use the Facebook Javascript SDK (witch is the one I use most) to accomplish what you want.
Let's say that you only need email and name, so: Basic + Email permissions:

Code:
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : 'YOUR_APP_ID', // App ID
channelURL : '//WWW.YOUR_DOMAIN.COM/channel.html', // Channel File
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
oauth : true, // enable OAuth 2.0
xfbml : true // parse XFBML
});

// Additional initialization code here
};

// Load the SDK Asynchronously
(function(d){
var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
d.getElementsByTagName('head')[0].appendChild(js);
}(document));

function facebookLogin() {
FB.login(function (response) {
access_token = response.session.access_token;
if (response.session) {
if (response.perms) {
// refresh page
window.location.reload();
} else {
// user is logged in, but did not grant any permissions
}
} else {
// user is not logged in
}
}, { perms: 'email' });
}
</script>

and in your page use:

Code:
<a href="#" class="myButton" onclick="facebookLogin();">Connect to Facebook</a>

or if you want to use Facebook buttons:

https://developers.facebook.com/docs/reference/plugins/login/

custom examples: http://www.fbrell.com/xfbml/fb:login-button

after the window.location.reload(); you are able to get what you want from facebook, such as the the user Name, Email, etc with

Code:
FB.api('/me', function (user) {
if (user != null) {
if (user.error) {
// can't get info
} else {
var image = document.getElementById('image');
image.src = 'https://graph.facebook.com/' + user.id + '/picture';
var name = document.getElementById('name');
name.innerHTML = user.name
}
}
});

more here: https://developers.facebook.com/docs/guides/web/
Posted
Junior Member
pierretopping
Posts: 224
224
That's great. Thank you for your time explaining it to us :-)
Posted
Junior Member
balexandre
Posts: 418
418
an easy way of doing all this, is upon getting "email", "name" and "avatar", just create a normal user account with the "facebook_user_id" as the username, and next time user is on the website, just login automatically with those credentials ...
as soon as the user gives you permissions to grab the data you request, he does not need to do anything else, every time you initialize the facebook javascript and ask for the user credentials using the
Code:
FB.api('/me', function(response) {
alert(response.name);
});
request, it's all there.
You you need more help, just ask smile
 
You Must enter a message