Error connecting with login URI

138 views
Skip to first unread message

Abel Fernández del Pino

unread,
Jan 9, 2012, 11:38:06 AM1/9/12
to google-docum...@googlegroups.com
Hi,
I'm a newbie on Google API. I've read the documentation but I have an error whith autentication that I don't know how to solve it.
My code is:

import com.google.gdata.client.docs.DocsService;
import com.google.gdata.data.docs.DocumentListEntry;
import com.google.gdata.data.docs.DocumentListFeed;
import java.net.URL;

public class Docs{
    public static void main(String[] args){
        try{
            System.getProperties().put("http.proxySet", "true" );
            System.getProperties().put("http.proxyHost", "proxy" );
            System.getProperties().put("http.proxyPort", "port" );
            System.getProperties().put("http.proxyUser", "user");
            System.getProperties().put("http.proxyPassword", "pwd");
           
            URL url_feed=new URL("https://docs.google.com/feeds/documents/private/full");           
            DocsService client = new DocsService("UIC-GDocs-v1");
            System.out.println("authenticating ....");
            client.setUserCredentials("myu...@gmail.com", "mypwd",ClientLoginAccountType.HOSTED_OR_GOOGLE); //Line with the error
           
System.out.println("authenticated.");
            DocumentListFeed feed=client.getFeed(url_feed, DocumentListFeed.class);
            for(DocumentListEntry entry : feed.getEntries()){
               System.out.println(entry.getTitle().getPlainText());               
            }
        }catch (Exception ex){
            System.err.println("Exception: "+ex.getMessage());
            ex.printStackTrace();
        }
    }   
}


And the error is:

authenticating ....
Exception: Error connecting with login URI
com.google.gdata.util.AuthenticationException: Error connecting with login URI
    at com.google.gdata.client.GoogleAuthTokenFactory.getAuthToken(GoogleAuthTokenFactory.java:489)
    at com.google.gdata.client.GoogleAuthTokenFactory.setUserCredentials(GoogleAuthTokenFactory.java:346)
    at com.google.gdata.client.GoogleService.setUserCredentials(GoogleService.java:362)
    at com.google.gdata.client.GoogleService.setUserCredentials(GoogleService.java:317)
    at Docs.main(Docs.java:28)
Caused by: java.net.ConnectException: Connection timed out: connect
    at java.net.TwoStacksPlainSocketImpl.socketConnect(Native Method)
    at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
    at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
    at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
    at java.net.PlainSocketImpl.connect(Unknown Source)
    at java.net.SocksSocketImpl.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.connect(Unknown Source)
    at sun.security.ssl.BaseSSLSocketImpl.connect(Unknown Source)
    at sun.net.NetworkClient.doConnect(Unknown Source)
    at sun.net.www.http.HttpClient.openServer(Unknown Source)
    at sun.net.www.http.HttpClient.openServer(Unknown Source)
    at sun.net.www.protocol.https.HttpsClient.<init>(Unknown Source)
    at sun.net.www.protocol.https.HttpsClient.New(Unknown Source)
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown Source)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(Unknown Source)
    at com.google.gdata.client.GoogleAuthTokenFactory.makePostRequest(GoogleAuthTokenFactory.java:551)
    at com.google.gdata.client.GoogleAuthTokenFactory.getAuthToken(GoogleAuthTokenFactory.java:487)
    ... 4 more

I've search in this forum and other forums but I haven't found solution. In this forum there 2 posts about the topic:
http://code.google.com/intl/es-ES/apis/documents/forum.html?place=topic%2Fgoogle-documents-list-api%2Fe77O_IEFNa4%2Fdiscussion
http://code.google.com/intl/es-ES/apis/documents/forum.html?place=topic%2Fgoogle-documents-list-api%2F1gD1M8rKZNw%2Fdiscussion

Somebody can help me? Thanks a lot.


Goa

unread,
Jan 9, 2012, 12:15:51 PM1/9/12
to google-docum...@googlegroups.com
Are you trying to use the Client Login Procedure?
Reply all
Reply to author
Forward
0 new messages