Google APIs Client Library for Java

Overview
Setup Instructions
Component Modules
Android
Google App Engine
Batching
Media Download
Media Upload
OAuth 2.0
Timeouts and Errors
Support

Running on Google App Engine

App Engine-specific helpers make quick work of authenticated calls to APIs, and you do not need to worry about exchanging code for tokens.

For example:

  @Override 
 protected 
 void 
 doGet 
 ( 
 HttpServletRequest 
 req 
 , 
 HttpServletResponse 
 resp 
 ) 
 throws 
 IOException 
 { 
 AppIdentityCredential 
 credential 
 = 
 new 
 AppIdentityCredential 
 ( 
 Arrays 
 . 
 asList 
 ( 
 UrlshortenerScopes 
 . 
 URLSHORTENER 
 )); 
 Urlshortener 
 shortener 
 = 
 new 
 Urlshortener 
 . 
 Builder 
 ( 
 new 
 UrlFetchTransport 
 (), 
 new 
 JacksonFactory 
 (), 
 credential 
 ) 
 . 
 build 
 (); 
 UrlHistory 
 history 
 = 
 shortener 
 . 
 URL 
 (). 
 list 
 (). 
 execute 
 (); 
 ... 
 } 
 

Auth helpers

If you are building a web app that interacts with a user’s data via an OAuth 2.0-enabled API, we’ve created some helpers to assist you with the process. The helpers aim to:

  • Simplify the process of obtaining access tokens ( AuthorizationCodeFlow ).
  • Manage tokens, after they are obtained, by marking them as PersistenceCapable .
  • Simplify the process of making authenticated calls using the access token’s credential .
  • Insulate you from the details of authentication when writing servlets.

Getting started

  1. Install the Google API Client Library for Java:
    • Follow the download instructions and put the library jar files into your war/WEB-INF/lib directory.
    • Alternatively, you can use Maven .
  2. Learn about using OAuth 2.0 with the authorization code flow for Google App Engine applications .
  3. Learn about using OAuth 2.0 with the Google App Engine Identity API .
  4. Take a look at the Calendar App Engine sample . This sample combines our Java library and auth helpers to show you how to access end-user data from within a Google App Engine web app. The sample also uses GWT for the user interface.
Design a Mobile Site
View Site in Mobile | Classic
Share by: