Examples of AuthToken


Examples of com.appspot.piment.model.AuthToken

    if (commentUserId.equals(this.tqqWeiboApi.getUsetId())) {
      tqqApi = this.tqqWeiboApi;
    } else {
      UserMap userMap = this.userMapDao.getUserMap(commentUserId);
      if (userMap != null && StringUtils.isNotBlank(userMap.getTqqUserId())) {
      AuthToken tempAuthToken = this.authTokenDao.getByUserId(userMap.getTqqUserId(), WeiboSource.Tqq);
      this.tqqTempWeiboApi.setAuthToken(tempAuthToken);
      tqqApi = this.tqqTempWeiboApi;
      } else {
      tqqApi = this.tqqRobotWeiboApi;
      commentMsg = "Sina @" + comment.getUser().getScreenName() + "//" + commentMsg;
View Full Code Here

Examples of com.britesnow.snow.web.auth.AuthToken

   * <p>Mock method to set the AuthToken to be this user.</p>
   * <p>Very usefull to test request flow without testing the authentication flow.</p>
   * @param user
   */
  public void setUser(Object user){
    super.setAuthToken(new AuthToken(user));
  }
View Full Code Here

Examples of com.google.api.ads.dfp.lib.AuthToken

  public static void main(String[] args) throws IOException, AuthTokenException, ServiceException {
    String email = "INSERT_EMAIL_ADDRESS_HERE";
    String password = "INSERT_PASSWORD_HERE";

    // Create AuthToken class from DfpUser object.
    AuthToken authToken = new AuthToken(email, password);

    // Get DfpUser from "~/dfp.properties". In the properties file,
    // you will only need to set the networkCode (if needed).
    DfpUser user = new DfpUser();

    // Uncomment to cause a CAPTCHA required failure.
    // causeCaptchaError(authToken);

    String authTokenString = "";

    // Handle CAPTCHA error.
    try {
      // Get auth token string.
      authTokenString = authToken.getAuthToken();
    } catch (AuthTokenException e) {
      if (e.getErrorCode() != null && e.getErrorCode().equals("CaptchaRequired")) {
        // Try getting the auth token again but with a captcha.
        System.out.println("Go here and read the captcha: " + e.getCaptchaInfo().getCaptchaUrl());
        System.out.print("Answer is: ");
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        String answer = in.readLine().trim();
        authTokenString =
            new AuthToken(authToken, e.getCaptchaInfo().getCaptchaToken(), answer).getAuthToken();
      } else {
        throw e;
      }
    }


    // Set the auth token in the user so that it will not be generated when
    // user.getService() is called.
    user.setAuthToken(authTokenString);

    // Handle possible token expiration. You can cause an expiration by
    // pausing this code and changing the password of the account before the
    // first makeApiRequest() is called. If you do so, change your password back
    // before you regenerate the auth token again.
    try {
      makeApiRequest(user);
    } catch (ApiException e) {
      for (ApiError error : e.getErrors()) {
        if (error instanceof AuthenticationError) {
          AuthenticationError authError = (AuthenticationError) error;
          if (authError.getReason() == AuthenticationErrorReason.INVALID_EMAIL) {
            // Try to regenerate auth token here again in case it expired.
            user.setAuthToken(authToken.getAuthToken());
            makeApiRequest(user);
          } else {
            System.err.println("Service call failed for authentication reason: "
                + authError.getReason());
          }
View Full Code Here

Examples of com.google.api.adwords.lib.AuthToken

      AdWordsServiceLogger.log();

      String loginEmail = "2steptester@gmail.com";
      String password = "testaccount";

      System.out.println(new AuthToken(loginEmail, password).getAuthToken());
    } catch (AuthTokenException e) {
      if (e.getErrorCode().contains("InvalidSecondFactor")) {
        System.out
            .println("The user has enabled two factor authentication in this account. Have the "
                + "user generate an application-specific password to make calls against the "
View Full Code Here

Examples of com.google.api.adwords.lib.AuthToken

      AdWordsServiceLogger.log();

      String loginEmail = "2steptester@gmail.com";
      String password = "testaccount";

      System.out.println(new AuthToken(loginEmail, password).getAuthToken());
    } catch (AuthTokenException e) {
      if (e.getErrorCode().contains("InvalidSecondFactor")) {
        System.out
            .println("The user has enabled two factor authentication in this account. Have the "
                + "user generate an application-specific password to make calls against the "
View Full Code Here

Examples of com.google.api.adwords.lib.AuthToken

  }

  private static void reloadAuthToken(AdWordsUser adWordsUser) throws AuthTokenException {
    if (adWordsUser.getRegisteredAuthToken() == null) {
      adWordsUser.setAuthToken(
          new AuthToken(adWordsUser.getEmail(), adWordsUser.getPassword()).getAuthToken());
    }
  }
View Full Code Here

Examples of com.google.api.adwords.lib.AuthToken

  public static void main(String[] args) throws IOException, AuthTokenException, ServiceException {
    String email = "INSERT_EMAIL_ADDRESS_HERE";
    String password = "INSERT_PASSWORD_HERE";

    // Create AuthToken class from AdWordsUser object.
    AuthToken authToken = new AuthToken(email, password);

    // Get AdWordsUser from "~/adwords.properties". In the properties file,
    // you will only need to set the developerToken, useragent, or clientId (if
    // needed).
    AdWordsUser user = new AdWordsUser();

    // Uncomment to cause a CAPTCHA required failure.
    // causeCaptchaError(authToken);

    String authTokenString = "";

    // Handle CAPTCHA error.
    try {
      // Get auth token string.
      authTokenString = authToken.getAuthToken();
    } catch (AuthTokenException e) {
      if (e.getErrorCode() != null && e.getErrorCode().equals("CaptchaRequired")) {
        // Try getting the auth token again but with a captcha.
        System.out.println("Go here and read the captcha: " + e.getCaptchaInfo().getCaptchaUrl());
        System.out.print("Answer is: ");
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        String answer = in.readLine().trim();
        authTokenString =
            new AuthToken(authToken, e.getCaptchaInfo().getCaptchaToken(), answer).getAuthToken();
      } else {
        throw e;
      }
    }


    // Set the auth token in the user so that it will not be generated when
    // user.getService() is called.
    user.setAuthToken(authTokenString);

    // Handle possible token expiration. You can cause an expiration by
    // pausing this code and changing the password of the account before the
    // first makeApiRequest() is called. If you do so, change your password back
    // before you regenerate the auth token again.
    try {
      makeApiRequest(user);
    } catch (ApiException e) {
      for (ApiError error : e.getErrors()) {
        if (error instanceof AuthenticationError) {
          AuthenticationError authError = (AuthenticationError) error;
          if (authError.getReason() == AuthenticationErrorReason.GOOGLE_ACCOUNT_COOKIE_INVALID) {
            // Try to regenerate auth token here again in case it expired.
            user.setAuthToken(authToken.getAuthToken());
            makeApiRequest(user);
          } else {
            System.err.println("Service call failed for authentication reason: "
                + authError.getReason());
          }
View Full Code Here

Examples of com.google.api.adwords.lib.AuthToken

  }

  private static void reloadAuthToken(AdWordsUser adWordsUser) throws AuthTokenException {
    if (adWordsUser.getRegisteredAuthToken() == null) {
      adWordsUser.setAuthToken(
          new AuthToken(adWordsUser.getEmail(), adWordsUser.getPassword()).getAuthToken());
    }
  }
View Full Code Here

Examples of com.google.api.explorer.client.AuthManager.AuthToken

    display.hideScopeDialog();
    EasyMock.expectLastCall();
    display.setState(State.PRIVATE, authScopes, authScopes);
    EasyMock.expectLastCall();

    AuthToken token = EasyMock.createMock(AuthToken.class);
    EasyMock.expect(token.getScopes()).andReturn(authScopes);
    EasyMock.expect(authManager.getToken(service)).andReturn(token);

    EasyMock.replay(service, display, method1, method2, authManager, token);

    AuthPresenter presenter = new AuthPresenter(service, authManager, analytics, display);
View Full Code Here

Examples of com.sun.xml.registry.uddi.bindings_v2_2.AuthToken

    /**
     * Create an instance of {@link AuthToken }
     *
     */
    public AuthToken createAuthToken() {
        return new AuthToken();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.