Examples of refreshToken()


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

    TestDefaultCredentialProvider testProvider = new TestDefaultCredentialProvider();

    Credential defaultCredential = testProvider.getDefaultCredential(transport, JSON_FACTORY);
    assertNotNull(defaultCredential);

    assertTrue(defaultCredential.refreshToken());
    assertEquals(ACCESS_TOKEN, defaultCredential.getAccessToken());
  }

  public void testDefaultCredentialComputeErrorNotFound() throws IOException {
    MockMetadataServerTransport transport = new MockMetadataServerTransport(ACCESS_TOKEN);
View Full Code Here

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

    Credential defaultCredential = testProvider.getDefaultCredential(transport, JSON_FACTORY);
    assertNotNull(defaultCredential);

    try {
      defaultCredential.refreshToken();
      fail("Expected error refreshing token.");
    } catch (IOException expected) {
      String message = expected.getMessage();
      assertTrue(message.contains(Integer.toString(HttpStatusCodes.STATUS_CODE_NOT_FOUND)));
      assertTrue(message.contains("scope"));
View Full Code Here

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

    Credential defaultCredential = testProvider.getDefaultCredential(transport, JSON_FACTORY);
    assertNotNull(defaultCredential);

    try {
      defaultCredential.refreshToken();
      fail("Expected error refreshing token.");
    } catch (IOException expected) {
      String message = expected.getMessage();
      assertTrue(message.contains(Integer.toString(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)));
      assertTrue(message.contains("Unexpected"));
View Full Code Here

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

      Credential credential = testProvider.getDefaultCredential(transport, JSON_FACTORY);

      assertNotNull(credential);
      assertEquals(refreshTokenEnv, credential.getRefreshToken());
      assertTrue(credential.refreshToken());
      assertEquals(accessTokenEnv, credential.getAccessToken());
    } finally {
      if (wellKnownFile.exists()) {
        wellKnownFile.delete();
      }
View Full Code Here

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

      Credential credential = testProvider.getDefaultCredential(transport, JSON_FACTORY);

      assertNotNull(credential);
      assertEquals(refreshToken, credential.getRefreshToken());

      assertTrue(credential.refreshToken());
      assertEquals(ACCESS_TOKEN, credential.getAccessToken());
    } finally {
      if (userFile.exists()) {
        userFile.delete();
      }
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();

        // 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()

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

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


        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
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.