Package com.google.api.client.googleapis.extensions.java6.auth.oauth2

Examples of com.google.api.client.googleapis.extensions.java6.auth.oauth2.GooglePromptReceiver


        // Build the local server and bind it to port 9000
        LocalServerReceiver localReceiver = new LocalServerReceiver.Builder()
                .setPort(8080).build();

        // Authorize.
        return new AuthorizationCodeInstalledApp(flow, localReceiver)
                .authorize("user");
    }
View Full Code Here


            "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);
      }
      // set up file credential store
      FileCredentialStore credentialStore = new FileCredentialStore(
          new File(System.getProperty("user.home"), ".credentials/calendar.json"), JSON_FACTORY);
      // set up authorization code flow
      GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder(
          HTTP_TRANSPORT, JSON_FACTORY, clientSecrets,
          Collections.singleton(CalendarScopes.CALENDAR)).setCredentialStore(credentialStore).build();
View Full Code Here

  /**
   * Returns the CredentialStore to be used when calling
   * {@link OAuth2Native#getAuthorizationCodeFlow(boolean)} with parameter {@code true}.
   */
  protected CredentialStore getCredentialStore(JsonFactory jsonFactory) throws IOException {
    return new FileCredentialStore(getTokenStoreFile(), jsonFactory);
  }
View Full Code Here

  }

  /** Authorizes the installed application to access user's protected data. */
  private Credential authorize() throws Exception {
    // set up file credential store
    final FileCredentialStore credentialStore = new FileCredentialStore(
        new File(System.getProperty("user.home"), ".credentials/calendar.json"), jsonFactory);
    // set up authorization code flow
    final GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder(
        httpTransport, jsonFactory, GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, Collections.singleton(CalendarScopes.CALENDAR))
      .setCredentialStore(credentialStore)
View Full Code Here

  }

  public static Credential authorise(List<String> scopes,
      File credentialDataStore) throws IOException {

    FileCredentialStore credentialStore = new FileCredentialStore(
        credentialDataStore, JSON_FACTORY);

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

              + "into prediction-cmdline-sample/src/main/resources/client_secrets.json");
      System.exit(1);
    }

    // set up file credential store
    FileCredentialStore credentialStore = new FileCredentialStore(new File(
        "C:\\jee\\workspace\\Prediction Java\\src\\prediction.json"),
        JSON_FACTORY);

    // set up authorization code flow
    GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder(
View Full Code Here

                   
            System.exit(1);
        }

        // Set up file credential store.
        FileCredentialStore credentialStore = new FileCredentialStore(new File(
                System.getProperty("user.home"),
                ".credentials/youtube-api-uploadvideo.json"), JSON_FACTORY);

        // Set up authorization code flow.
        GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder(
View Full Code Here

      cmdLine.setArgs(args);

      // Authorization
      BaseCommand command = cmdLine.getCommand();
      List<String> scopes = command.getScopes();
      VerificationCodeReceiver receiver = command.noLocalServer ? new GooglePromptReceiver() :
          new LocalServerReceiver();

      GenomicsFactory genomicsFactory = GenomicsFactory.builder("genomics_java_client")
          .setScopes(scopes)
          .setUserName("user" + scopes.toString())
View Full Code Here

      cmdLine.setArgs(args);

      // Authorization
      BaseCommand command = cmdLine.getCommand();
      List<String> scopes = command.getScopes();
      VerificationCodeReceiver receiver = command.noLocalServer ? new GooglePromptReceiver() :
          new LocalServerReceiver();

      GenomicsFactory genomicsFactory = GenomicsFactory.builder("genomics_java_client")
          .setScopes(scopes)
          .setUserName("user" + scopes.toString())
View Full Code Here

TOP

Related Classes of com.google.api.client.googleapis.extensions.java6.auth.oauth2.GooglePromptReceiver

Copyright © 2018 www.massapicom. 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.