Examples of GoogleClientSecrets


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

    static final java.util.List<Calendar> addedCalendarsUsingBatch = Lists.newArrayList();

    /** Authorizes the installed application to access user's protected data. */
    private static Credential authorize() throws Exception {
      // load client secrets
      GoogleClientSecrets clientSecrets = GoogleClientSecrets.load(
          JSON_FACTORY, CalManager.class.getResourceAsStream("/client_secrets.json"));
      if (clientSecrets.getDetails().getClientId().startsWith("Enter")
          || clientSecrets.getDetails().getClientSecret().startsWith("Enter ")) {
        System.out.println(
            "Enter Client ID and Secret from https://code.google.com/apis/console/?api=calendar "
            + "into calendar-cmdline-sample/src/main/resources/client_secrets.json");
        System.exit(1);
      }
View Full Code Here

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

   * @param clientSecretOverride The client secret to use
   * @return The client secrets
   */
  private static GoogleClientSecrets createClientSecrets(
      final String clientIdOverride, final String clientSecretOverride) {
    return new GoogleClientSecrets().setInstalled(new GoogleClientSecrets.Details().setClientId(
        clientIdOverride).setClientSecret(clientSecretOverride));
  }
View Full Code Here

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

  protected GoogleAuthorizationCodeFlow getAuthorizationCodeFlow(boolean usePersistedCredentials)
      throws IOException {
    HttpTransport httpTransport = new NetHttpTransport();
    JsonFactory jsonFactory = new JacksonFactory();
    Collection<String> scopes = Arrays.asList(OAUTH2_SCOPE);
    GoogleClientSecrets clientSecrets = getClientSecrets();
    GoogleAuthorizationCodeFlow flow;
    if (usePersistedCredentials) {
      flow = new GoogleAuthorizationCodeFlow.Builder(
        httpTransport, jsonFactory, clientSecrets, scopes).setAccessType("offline")
        .setApprovalPrompt("force").setCredentialStore(getCredentialStore(jsonFactory)).build();
View Full Code Here

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

     */
    private static Credential authorizeWithInstalledApplication() throws IOException {
        log.info("Authorizing using installed application");

        // load client secrets
        GoogleClientSecrets clientSecrets = GoogleClientSecrets.load(
                JSON_FACTORY,
                new InputStreamReader(
                        AndroidPublisherHelper.class
                                .getResourceAsStream(RESOURCES_CLIENT_SECRETS_JSON)));
        // Ensure file has been filled out.
View Full Code Here

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

     */
    public static Credential authorize(List<String> scopes, String credentialDatastore) throws IOException {

        // Load client secrets.
        Reader clientSecretReader = new InputStreamReader(Auth.class.getResourceAsStream("/client_secrets.json"));
        GoogleClientSecrets clientSecrets = GoogleClientSecrets.load(JSON_FACTORY, clientSecretReader);

        // Checks that the defaults have been replaced (Default = "Enter X here").
        if (clientSecrets.getDetails().getClientId().startsWith("Enter")
                || clientSecrets.getDetails().getClientSecret().startsWith("Enter ")) {
            System.out.println(
                    "Enter Client ID and Secret from https://code.google.com/apis/console/?api=youtube"
                            + "into src/main/resources/client_secrets.json");
            System.exit(1);
        }
View Full Code Here

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

      File credentialDataStore) throws IOException {

    FileCredentialStore credentialStore = new FileCredentialStore(
        credentialDataStore, JSON_FACTORY);

    GoogleClientSecrets clientSecrets = GoogleClientSecrets.load(
        JSON_FACTORY,
        Auth.class.getResourceAsStream("/client_secrets.json"));

    GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder(
        HTTP_TRANSPORT, JSON_FACTORY, clientSecrets, scopes)
View Full Code Here

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

  public static void main(String[] args) throws Exception {
    // Get the client ID and secret from the ads.properties file.
    // If you do not have a client ID or secret, please create one in the
    // API console: https://code.google.com/apis/console#access and set it
    // in the ads.properties file.
    GoogleClientSecrets clientSecrets = null;
    try {
      clientSecrets = new GoogleClientSecretsBuilder()
          .forApi(Api.DFA)
          .fromFile()
          .build();
View Full Code Here

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

  public static void main(String[] args) throws Exception {
    // Get the client ID and secret from the ads.properties file.
    // If you do not have a client ID or secret, please create one in the
    // API console: https://code.google.com/apis/console#access and set it
    // in the ads.properties file.
    GoogleClientSecrets clientSecrets = null;
    try {
      clientSecrets = new GoogleClientSecretsBuilder()
          .forApi(Api.ADWORDS)
          .fromFile()
          .build();
View Full Code Here

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

    public GoogleClientSecrets build() throws ValidationException {
      validate();
      Details details = new Details();
      details.setClientId(clientId);
      details.setClientSecret(clientSecret);
      GoogleClientSecrets googleClientSecrets = new GoogleClientSecrets();
      googleClientSecrets.setInstalled(details);
      return googleClientSecrets;
    }
View Full Code Here

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

  public static void main(String[] args) throws Exception {
    // Get the client ID and secret from the ads.properties file.
    // If you do not have a client ID or secret, please create one in the
    // API console: https://code.google.com/apis/console#access and set it
    // in the ads.properties file.
    GoogleClientSecrets clientSecrets = null;
    try {
      clientSecrets = new GoogleClientSecretsBuilder()
          .forApi(Api.DFP)
          .fromFile()
          .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.