I have implemented with GWT an OpenId authentication service that works for Google and Yahoo. Users of both platforms are allowed to login with their account to my website, and we can retrieve some basic information (e-mail address). This is a piece of my code.
private static final Map<String, String> openIdProviders;
static {
openIdProviders = new HashMap<String, String>();
openIdProviders.put("Google", "https://www.google.com/accounts/o8/id");
openIdProviders.put("Yahoo", "http://open.login.yahooapis.com/openid20/www.yahoo.com/xrds");
}
userInfo.isSignedIn = false;
for (String providerName : openIdProviders.keySet()) {
String providerUrl = openIdProviders.get(providerName);
String loginUrl = userService.createLoginURL(action.getRequestURI(), null, providerUrl, new HashSet<String>());
userInfo.signInURLs.put(providerName, loginUrl);
}
How can I do the same for Facebook and Twitter? Seems that they are not openId providers, right? Stackoverflow seems to have this implemented for login.
Thanks
Facebook authenticates via OAuth 2.0. Examples exist for both client-side and server-side authentication. Twitter is similar.
On the client side, GWT JS Overlay Types will help you wrap the JS calls you need to make.