Search in sources :

Example 1 with FacebookAPI

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);
}
Also used : FacebookAPI(org.mamute.auth.FacebookAPI) Token(org.scribe.model.Token) Verifier(org.scribe.model.Verifier) SocialAPI(org.mamute.auth.SocialAPI) Get(br.com.caelum.vraptor.Get)

Aggregations

Get (br.com.caelum.vraptor.Get)1 FacebookAPI (org.mamute.auth.FacebookAPI)1 SocialAPI (org.mamute.auth.SocialAPI)1 Token (org.scribe.model.Token)1 Verifier (org.scribe.model.Verifier)1