Menu

Tree [3c8396] master /
 History

HTTPS access


File Date Author Commit
 javadoc 2012-04-05 Alex Franchuk Alex Franchuk [3c8396] Added in more information to README, ability to...
 FacebookLogin.java 2012-04-05 Alex Franchuk Alex Franchuk [3c8396] Added in more information to README, ability to...
 README 2012-04-05 Alex Franchuk Alex Franchuk [3c8396] Added in more information to README, ability to...

Read Me

JFBLogin - Provides a simple facebook authentication fronend in Java.
    Copyright (C) 2012  Alex Franchuk

===== License =====
GPLv3:
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.


===== Description =====

This project offers a simple java class to be used for
any Facebook authentication needs. This class allows you
to simply pass the Facebook application client id and show
a login and authentication window, and returns the session
token from Facebook.

This is extremely useful for anyone who wishes to make a
program in Java that needs to be able to have a user login
and subsequently access the Facebook API to get any
information about the user.

Uses the DJNativeSwing library.


===== Libraries =====
The only required library, besides the standard Java 5/6 libraries,
is the DJNativeSwing library.
This is used to provide a native browser frontend.

DJNativeSwing library: http://djproject.sourceforge.net/ns/

From the downloaded zip, include DJNativeSwing.jar and DJNativeSwing-SWT.jar
in the classpath of your program.


===== Usage =====
To create a new FacebookLogin object, call the class with the client
id as its constructor argument (a String), i.e:

FacebookLogin fblogin = new FacebookLogin("1234567890");

The class defaults to a large scope of the app, essentially requesting permissions
for everything possible. If this is not what you want, you can set the scope
manually with the setScope() method, passing it a string of comma-separated
scopes for the application. A full list of these scopes can be found
at:
https://developers.facebook.com/docs/authentication/permissions/

To show the dialog, call the show function with the parent Dialog,
or null to set no parent:

fblogin.show(parent);
NOTE: Once shown, the dialog will block until the window is closed
or the user logs on.

ALSO NOTE (AND THIS IS IMPORTANT!): The show method MUST be run from the AWT gui thread. If the show
method hangs, this is because it is in the wrong thread. To run it in the correct
thread, code along the lines of the following may be used:

SwingUtilities.invokeAndWait(new Runnable() {
	public void run() {
		fblogin.show(null);
	}
});

SwingUtilities is in the javax.swing package, and can be included simply with:
import javax.swing.SwingUtilities;

The show method returns true if the user logged in successfully, or false
otherwise.

Then, call the isLoggedOn method to get login/authentication status,
and call the getSessionToken method to get the session token as a string.


===== Contact =====
Email: alex.franchuk@gmail.com
or leave a message on sourceforge: jfblogin.sourceforge.net

MongoDB Logo MongoDB