Package com.google.api.client.json

Examples of com.google.api.client.json.JsonFactory


    if (credential.refreshToken()) {
      clientToken.setAccessToken(credential.getAccessToken());
      clientToken.setExpiresInSeconds(credential.getExpiresInSeconds());
      clientToken.setRefreshToken(credential.getRefreshToken());

      final JsonFactory jsonFactory = new JacksonFactory();
      storeClientToken(jsonFactory);
      LOGGER.log(Level.INFO, "refreshed client token stored in '" + clientTokenPath + "'");
    }
  }
View Full Code Here


private static String CLIENT_SECRET = "noZR-2HQmQiwYNPQ1rzOhfxE"
private static String REDIRECT_URI = "urn:ietf:wg:oauth:2.0:oob";   
public static void main(String[] args) throws IOException {   
 
  HttpTransport httpTransport = new NetHttpTransport();   
  JsonFactory jsonFactory = new JacksonFactory();      
  GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder(       
      httpTransport, jsonFactory, CLIENT_ID, CLIENT_SECRET, Arrays.asList(DriveScopes.DRIVE))       
  .setAccessType("online")       
  .setApprovalPrompt("auto").build();       
  String url = flow.newAuthorizationUrl().setRedirectUri(REDIRECT_URI).build();   
View Full Code Here

  private static String REDIRECT_URI = "urn:ietf:wg:oauth:2.0:oob";

  public static void main(String[] args) throws Exception {
    HttpTransport httpTransport = new NetHttpTransport();
    JsonFactory jsonFactory = new JacksonFactory();
    GoogleClientSecrets clientSecrets =
        GoogleClientSecrets.load(
            jsonFactory,
            new InputStreamReader(AccessTokenGeneratorApplication.class
                .getResourceAsStream(CLIENTSECRETS_LOCATION)));
View Full Code Here

  }

  public static GDrive authorize(GDriveTokens tokens) {
    try {
      NetHttpTransport httpTransport = new NetHttpTransport();
      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);
View Full Code Here

  @Override
  public DriveExec get() {
    try {
      NetHttpTransport httpTransport = new NetHttpTransport();
      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);
View Full Code Here

    System.out.println("Type the code you received here: ");
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String authorizationCode = in.readLine();

    HttpTransport transport = new NetHttpTransport();
    JsonFactory factory = new JacksonFactory();

    // Exchange for an access and refresh token
    GoogleAuthorizationCodeGrant authRequest = new GoogleAuthorizationCodeGrant(transport,
        factory, clientId, clientSecret, authorizationCode, AUTH_REDIRECT_URI);
    authRequest.useBasicAuthorization = false;
View Full Code Here

TOP

Related Classes of com.google.api.client.json.JsonFactory

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.