通过google账号登录iphone App



我是新手。如何登录到iphone原生应用程序通过谷歌帐户与示例代码。我搜索了很多教程,但没有找到完整的支持

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

点击这个链接,你的问题就解决了

相关内容

  • 没有找到相关文章

最新更新