0

I am new with this task. How to Login into iphone native App through google account With sample code.I have searched many tutorials but not found complete supporting .

iPatel
  • 46,010
  • 16
  • 115
  • 137
  • I think same question has been asked here: http://stackoverflow.com/q/4932122/1006780 – Dhairya Vora Jan 16 '13 at 11:08
  • You can find many similir question in stack overflow. Eg. 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-google-in-iphone-app – Dan Jan 16 '13 at 11:14

1 Answers1

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

Follow this link, this will solve your problem

Community
  • 1
  • 1
Dan
  • 2,086
  • 11
  • 71
  • 137