2013-01-16 109 views
0

我是新來的這個任務。如何通過谷歌賬戶登錄到iPhone本地應用程序示例代碼。我搜索了許多教程,但沒有找到完整的支持。通過谷歌帳戶登錄到iPhone應用程序。

+0

我想同樣的問題已經在這裏問:http://stackoverflow.com/q/4932122/1006780 –

+0

你可以在堆棧溢出許多similir問題。例如。 1. http://stackoverflow.com/questions/11413592/login-with-google-into-iphone-sdk-with-ios-5-or-later 2. http://stackoverflow.com/questions/8877912/login -with-谷歌功能於iphone,應用程序 –

回答

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()); 

關注這個link, this will solve your problem

相關問題