0

私はこの仕事が初めてです。サンプルコードを使用して、GoogleアカウントからiPhoneネイティブアプリにログインする方法.多くのチュートリアルを検索しましたが、完全なサポートが見つかりませんでした.

4

1 に答える 1

0
Here's the code that actually does the request - funny thing is that it works great if I use other APIs such as the URL shortener API:


    var scopes = new java.util.ArrayList();                                                                                                    
    scopes.add("https://www.googleapis.com/auth/drive");                                                                                       
    var appIdentity = AppIdentityServiceFactory.getAppIdentityService();                                                                       

       var accessToken = appIdentity.getAccessToken(scopes);

    var url = new URL("https://www.googleapis.com/drive/v2/files");                                                                            
    var connection = url.openConnection();                                                                                                     
    connection.setDoOutput(true);                                                                                                              
    connection.setRequestMethod("GET");                                                                                                        
    connection.addRequestProperty("Content-Type", "application/json");                                                                         
    connection.addRequestProperty("Authorization", "OAuth " + accessToken.getAccessToken());

このリンクをたどると、問題が解決します

于 2013-01-16T11:23:15.310 に答える