Examples of GoogleClientSecrets


Examples of com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets

  public void testGoogleSecretsReadPropertiesFromConfiguration() throws ValidationException {
    PropertiesConfiguration config = new PropertiesConfiguration();
    config.setProperty("api.dfp.clientId", "clientId");
    config.setProperty("api.dfp.clientSecret", "clientSecret");

    GoogleClientSecrets googleClientSecrets = new GoogleClientSecretsBuilder()
        .forApi(GoogleClientSecretsBuilder.Api.DFP)
        .from(config)
        .build();

    assertEquals(googleClientSecrets.getInstalled().getClientId(), "clientId");
    assertEquals(googleClientSecrets.getInstalled().getClientSecret(), "clientSecret");
  }
View Full Code Here

Examples of com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets

    config.setProperty("api.dfp.clientId", "clientIdDfp");
    config.setProperty("api.dfp.clientSecret", "clientSecretDfp");
    config.setProperty("api.adwords.clientId", "clientIdAdWords");
    config.setProperty("api.adwords.clientSecret", "clientSecretAdWords");

    GoogleClientSecrets googleClientSecrets = new GoogleClientSecretsBuilder()
        .forApi(GoogleClientSecretsBuilder.Api.DFP)
        .from(config)
        .build();

    assertEquals(googleClientSecrets.getInstalled().getClientId(), "clientIdDfp");
    assertEquals(googleClientSecrets.getInstalled().getClientSecret(), "clientSecretDfp");
  }
View Full Code Here

Examples of com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets

  @Test(expected = ValidationException.class)
  public void testGoogleSecretsReadPropertiesFromConfiguration_missingClientId() throws Exception {
    PropertiesConfiguration config = new PropertiesConfiguration();
    config.setProperty("api.dfp.clientSecret", "clientSecret");

    GoogleClientSecrets googleClientSecrets = new GoogleClientSecretsBuilder()
        .forApi(GoogleClientSecretsBuilder.Api.DFP)
        .from(config)
        .build();
  }
View Full Code Here

Examples of com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets

  public void testGoogleSecretsReadPropertiesFromConfiguration_missingClientSecret()
      throws Exception {
    PropertiesConfiguration config = new PropertiesConfiguration();
    config.setProperty("api.dfp.clientId", "clientId");

    GoogleClientSecrets googleClientSecrets = new GoogleClientSecretsBuilder()
        .forApi(GoogleClientSecretsBuilder.Api.DFP)
        .from(config)
        .build();
  }
View Full Code Here

Examples of com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets

    when(configurationHelper.fromFile("path")).thenReturn(config);

    GoogleClientSecretsForApiBuilder builder = new GoogleClientSecretsForApiBuilder(
        configurationHelper, GoogleClientSecretsBuilder.Api.DFP);

    GoogleClientSecrets googleClientSecrets = builder.fromFile("path").build();

    assertEquals(googleClientSecrets.getInstalled().getClientId(), "clientId");
    assertEquals(googleClientSecrets.getInstalled().getClientSecret(), "clientSecret");
  }
View Full Code Here

Examples of com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets

      JsonFactory jsonFactory = new JacksonFactory();

      URL url = Resources.getResource(GDrive.class, CLIENTSECRETS_LOCATION);
      CharSource charSource = Resources.asCharSource(url, Charsets.UTF_8);
      Reader reader = charSource.openStream();
      GoogleClientSecrets clientSecrets = GoogleClientSecrets.load(jsonFactory, reader);

      GoogleCredential credential = new GoogleCredential.Builder()
          .setTransport(httpTransport)
          .setJsonFactory(jsonFactory)
          .setClientSecrets(clientSecrets)
View Full Code Here

Examples of com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets

     *            list of scopes needed to run youtube upload.
     */
    private static Credential authorize(List<String> scopes) throws Exception {

        // Load client secrets.
        GoogleClientSecrets clientSecrets = GoogleClientSecrets.load(
                JSON_FACTORY,
                YoutubeVideoServiceImpl.class.getResourceAsStream("/client_secrets.json"));

        // Checks that the defaults have been replaced (Default =
        // "Enter X here").
        if (clientSecrets.getDetails().getClientId().startsWith("Enter")
                || clientSecrets.getDetails().getClientSecret()
                        .startsWith("Enter ")) {
            logger.error("Enter Client ID and Secret from https://code.google.com/apis/console/?api=youtube"
                    + "into youtube-cmdline-uploadvideo-sample/src/main/resources/client_secrets.json");
                   
            System.exit(1);
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.