0

我是这个任务的新手。如何通过谷歌账户登录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 回答