2013-10-01 67 views
0

我想實現這個例子,谷歌驅動器認證在GWT

https://google-developers.appspot.com/drive/auth/web-server

但是下面的類都沒有發現!發現Oauth2Userinfo

static User getUserInfo(Credential credentials) 
     throws NoUserIdException { 
    Oauth2 userInfoService = 
     new Oauth2.Builder(new NetHttpTransport(), new JacksonFactory(), credentials).build(); 
    Userinfo userInfo = null; 
    try { 
     userInfo = userInfoService.userinfo().get().execute(); 
    } catch (IOException e) { 
     System.err.println("An error occurred: " + e); 
    } 
    if (userInfo != null && userInfo.getId() != null) { 
     return userInfo; 
    } else { 
     throw new NoUserIdException(); 
    } 
    } 

所有其他類。我的構建路徑中有最新的Drive庫(Eclipse)。

這個例子是各種各樣的搞砸了。我之前已經實現了OAuth,這只是太冗長和過於複雜。用戶被髮送到Google進行身份驗證的位置甚至都不明顯。

回答