Package play.libs

Examples of play.libs.OAuth$TokenPair


  public static void oauthTwitter() {

    // first time the request comes here
    // the user has just pushed the "sign in with twitter button"
    if (!OAuth.isVerifierResponse()) {
      final OAuth twitter = OAuth.service(TWITTER);
      final OAuth.Response response = twitter.retrieveRequestToken();
      if (response.error==null) {
        final User user = new User();
        user.token = response.token;
        user.secret = response.secret;
        user.save();
        session.put("userId", user.id);
        redirect(twitter.redirectUrl(response.token));
      } else {
              Logger.error("Error contacting twitter: " + response.error);
              login();
          }
     
View Full Code Here


            } 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();
        }
    }
View Full Code Here

    }

    public static void auth() throws Exception {
        flash.keep(REDIRECT_URL);
        ServiceInfo serviceInfo = Dropbox.OAUTH;
        OAuth oauth = OAuth.service(serviceInfo);
        OAuth.Response oauthResponse = oauth.retrieveRequestToken();
        if (oauthResponse.error == null) {
            Logger.info("Redirecting to Dropbox for auth.");
            session.put(SessionKeys.TOKEN, oauthResponse.token);
            session.put(SessionKeys.SECRET, oauthResponse.secret);
            redirect(oauth.redirectUrl(oauthResponse.token) +
                    "&oauth_callback=" +
                    URLEncoder.encode(request.getBase() + "/auth-cb", "UTF-8"));
        } else {
            Logger.error("Error connecting to Dropbox: " + oauthResponse.error);
            error("Error connecting to Dropbox.");
View Full Code Here

TOP

Related Classes of play.libs.OAuth$TokenPair

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.