use of org.mamute.auth.FacebookAPI in project mamute by caelum.
the class FacebookAuthController method signupViaFacebook.
@Get("/sign-up/facebook/")
public void signupViaFacebook(String code, String state) {
if (code == null) {
includeAsList("mamuteMessages", i18n("error", "error.signup.facebook.unknown"));
redirectTo(SignupController.class).signupForm();
return;
}
Token token = service.getAccessToken(null, new Verifier(code));
SocialAPI facebookAPI = new FacebookAPI(service, token);
boolean success = loginManager.merge(MethodType.FACEBOOK, facebookAPI);
if (!success) {
includeAsList("mamuteMessages", i18n("error", "signup.errors.facebook.invalid_email", state));
result.redirectTo(AuthController.class).loginForm(state);
return;
}
redirectToRightUrl(state);
}
Aggregations