Esempio n. 1
0
 public static void authenticate() {
   User user = getUser();
   if (OAuth.isVerifierResponse()) {
     // We got the verifier; now get the access token, store it and back to index
     OAuth.Response oauthResponse =
         OAuth.service(TWITTER).retrieveAccessToken(user.token, user.secret);
     if (oauthResponse.error == null) {
       user.token = oauthResponse.token;
       user.secret = oauthResponse.secret;
       user.save();
     } else {
       Logger.error("Error connecting to twitter: " + oauthResponse.error);
     }
     index();
   }
   OAuth twitt = OAuth.service(TWITTER);
   OAuth.Response oauthResponse = twitt.retrieveRequestToken();
   if (oauthResponse.error == null) {
     // We received the unauthorized tokens in the OAuth object - store it before we proceed
     user.token = oauthResponse.token;
     user.secret = oauthResponse.secret;
     user.save();
     redirect(twitt.redirectUrl(oauthResponse.token));
   } else {
     Logger.error("Error connecting to twitter: " + oauthResponse.error);
     index();
   }
 }
Esempio n. 2
0
 public static void save(Project project) {
   System.out.println("---> " + project.isPersistent());
   Logger.warn("Next warning is intended!");
   project.save();
   validation.keep();
   show(project.id);
 }