possible to logon to forum with facebook account?

Snitz™ Forums 2000
https://forum.snitz.com/forumTopic/Posts/70033?pagenum=1
04 November 2025, 18:08

Topic


pierretopping
possible to logon to forum with facebook account?
28 October 2011, 15:01


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

 

Replies ...


Webbo
28 October 2011, 17:25


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
golfmann
29 October 2011, 11:19


Facebook:
600,000 accounts "compromised" a day and you want them to get into your forum?
I'll pass. smile
pierretopping
29 October 2011, 13:37


Thanks all for your thoughts :-)
RichardKinser
29 October 2011, 14:35


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.
balexandre
31 October 2011, 08:56


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+

pierretopping
31 October 2011, 14:52


Is this it I wonder?
http://developers.facebook.com/docs/plugins/registration/
balexandre
31 October 2011, 16:20


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/
pierretopping
01 November 2011, 14:41


That's great. Thank you for your time explaining it to us :-)
balexandre
01 November 2011, 21:54


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
© 2000-2021 Snitz™ Communications