Examples of refreshToken()


Examples of com.google.api.client.googleapis.auth.oauth2.GoogleCredential.refreshToken()

        .setRefreshToken(userModel.getRefreshToken());

        System.out.println("Old AccessToken:" +  userModel.getAccessToken());

        // リフレッシュトークンを元にアクセストークンを更新
        credential.refreshToken();

        System.out.println("new AccessToken:" +  credential.getAccessToken());

        Plus plus = new Plus(TRANSPORT, JSON_FACTORY, credential);
        Plus.Activities.List listActivities = plus.activities().list("me", "public").setFields(Constants.TARGET_ACTIVITY_FIELDS);
View Full Code Here

Examples of com.google.api.client.googleapis.auth.oauth2.GoogleCredential.refreshToken()

        .setTransport(TRANSPORT)
        .setClientSecrets(Constants.GOOGLE_PROJECT_CLIENT_ID, Constants.GOOGLE_PROJECT_CLIENT_SECRET).build()
        .setRefreshToken(userModel.getRefreshToken());

        // リフレッシュトークンを元にアクセストークンを更新
        credential.refreshToken();

        // Google+ API の設定(デフォルト1回につき20件)
        Plus plus = new Plus.Builder(TRANSPORT, JSON_FACTORY, credential)
        .setApplicationName(Constants.GOOGLE_APPLICATION_NAME)
        .build();
View Full Code Here

Examples of com.google.api.client.googleapis.auth.oauth2.GoogleCredential.refreshToken()

            .setTransport(TRANSPORT)
            .setClientSecrets(Constants.GOOGLE_PROJECT_CLIENT_ID, Constants.GOOGLE_PROJECT_CLIENT_SECRET).build()
            .setRefreshToken(userModel.getRefreshToken());

            // リフレッシュトークンを元にアクセストークンを更新
            credential.refreshToken();

            // Plus Object
            Plus plus = new Plus.Builder(TRANSPORT, JSON_FACTORY, credential)
            .setApplicationName(Constants.GOOGLE_APPLICATION_NAME)
            .build();
View Full Code Here

Examples of com.google.api.client.googleapis.auth.oauth2.GoogleCredential.refreshToken()

                // Don't worry about checking if we are running on a mirrored test instance.
                // Refreshing tokens independently on both the main server and a mirrored instance
                // seems to work just fine.

                // Try to swap the expired access token for a fresh one.
                tokenRefreshed = credential.refreshToken();

                if(tokenRefreshed) {
                    Long newExpireTime = credential.getExpirationTimeMilliseconds();
                    logger.info("google calendar token has been refreshed, new expire time = " + newExpireTime);
                    // Update stored expire time
View Full Code Here

Examples of com.google.api.client.googleapis.auth.oauth2.GoogleCredential.refreshToken()

                // Don't worry about checking if we are running on a mirrored test instance.
                // Refreshing tokens independently on both the main server and a mirrored instance
                // seems to work just fine.

                // Try to swap the expired access token for a fresh one.
                tokenRefreshed = credential.refreshToken();

                if(tokenRefreshed) {
                    Long newExpireTime = credential.getExpirationTimeMilliseconds();
                    // Update stored expire time
                    guestService.setApiKeyAttribute(apiKey, "accessToken", credential.getAccessToken());
View Full Code Here

Examples of com.google.api.client.googleapis.auth.oauth2.draft10.GoogleAccessProtectedResource.refreshToken()

    accessToken = authResponse.accessToken;
    refreshToken = authResponse.refreshToken;

    GoogleAccessProtectedResource access = new GoogleAccessProtectedResource(accessToken, transport,
        factory, clientId, clientSecret, refreshToken);
    access.refreshToken();
  }

  /*
   * Export waves to files
   */
 
View Full Code Here

Examples of com.google.api.client.googleapis.compute.ComputeCredential.refreshToken()

   */
  RemoteApiOptions useComputeEngineCredential() {
    try {
      HttpTransport transport = getOrCreateHttpTransportForOAuth();
      ComputeCredential credential = new ComputeCredential(transport, new JacksonFactory());
      credential.refreshToken();
      setOAuthCredential(credential);
    } catch (IOException|GeneralSecurityException e) {
      throw new RuntimeException("Failed to acquire Google Compute Engine credential.", e);
    }
    return this;
View Full Code Here

Examples of com.google.api.client.googleapis.compute.ComputeCredential.refreshToken()

    NetHttpTransport transport = GoogleNetHttpTransport.newTrustedTransport();
    try {
      // Try to connect using Google Compute Engine service account credentials.
      ComputeCredential credential = new ComputeCredential(transport, new JacksonFactory());
      // Force token refresh to detect if we are running on Google Compute Engine.
      credential.refreshToken();
      return credential;
    } catch (IOException e) {
      return null;
    }
  }
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.