6 messages in com.googlegroups.google-picasa-data-apiRe: Uploading pics via Servlets - Aut...| From | Sent On | Attachments |
|---|---|---|
| JCRL.Stargate | 09 Jul 2007 12:37 | |
| Ryan Boyd (Google) | 09 Jul 2007 15:12 | |
| JCRL.Stargate | 10 Jul 2007 10:16 | |
| Ryan Boyd (Google) | 10 Jul 2007 11:16 | |
| JCRL.Stargate | 10 Jul 2007 13:37 | |
| Ryan Boyd (Google) | 10 Jul 2007 13:40 |
| Subject: | Re: Uploading pics via Servlets - Authentication![]() |
|---|---|
| From: | Ryan Boyd (Google) (api....@google.com) |
| Date: | 07/10/2007 11:16:53 AM |
| List: | com.googlegroups.google-picasa-data-api |
Hello John,
On 7/10/07, JCRL.Stargate <jcrl...@gmail.com> wrote:
Hi Ryan,
Thanks for your reply. I am able to make a POST request afterall - except that I was POSTing to HTTP-non secure. I'm left with a reply with 3 cookies: SID and LSID I know are not in use and we only make of the Auth cookie... but is there a way for Google to GET/POST that cookie to one of my pages?
I'm sorry, but I'm not understanding the question. If you're using the client library (as in the code you posted), the ClientLogin response (containing the SID, LSID, and Auth value) is handled automatically and you don't need to deal with it manually.
Is your app a multi-user web app? If so, then you need to use the AuthSub mechanism of authentication. With this mechanism, the user visits your web application directly. If the user does not have an AuthSub session token stored in the servlet container session, then you redirect them to Google. The user then logs on, and validates the request. Once validated, the user is redirected back to your application with a token URL param. This token value is then exchanged for a session token by your application, and you can store the resulting session token in the user's servlet container session or in a database, etc for persistent use.
Cheers, -Ryan
Thanks,
John
On Jul 9, 6:13 pm, "Ryan Boyd (Google)" <api....@google.com> wrote:
Hi John,
If you are writing a web application where the application only needs to run as a single user, ClientLogin is fine.
However, you should never be prompting a user in a web application for their Picasa Web Albums/Google credentials. This is the intended purpose of AuthSub.
Calling setUserCredentials results in a request to the ClientLogin service to retrieve an authentication token: http://code.google.com/apis/accounts/AuthForInstalledApps.html#Client...
This works over SSL.
Are you sitting behind some sort of firewall/proxy that may be blocking HTTP POSTs tohttps://www.google.com/accounts/ClientLogin?
Cheers, -Ryan
On Jul 9, 12:37 pm, "JCRL.Stargate" <jcrl...@gmail.com> wrote:
Hello,
I'm trying to upload a picture to my account but unfortunately, my application hangs when it attempts to authenticate, namely:
PicasaweService pgs = new PicasawebService("SG-upload");
String token = pgs.getAuthToken("jcrl...@gmail.com", "myPassword", null, null, "Picasaweb", "SG-upload"); _OR_ pgs.setUserCredentials("jcrl...@gmail.com", "myPassword");
this is where it hangs and after a while the following is spat
out:
=========================================================== com.google.gdata.util.AuthenticationException: Error connecting with login URI at com.google.gdata.client.GoogleService.getAuthToken(Unknown Source) at SGL.main(SGL.java:37) <<---- [this is the "authentication line" from the code] Caused by: java.net.ConnectException: Connection timed out at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java: 333) at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182) at java.net.Socket.connect(Socket.java:519) at java.net.Socket.connect(Socket.java:469) at sun.net.NetworkClient.doConnect(NetworkClient.java:157) at sun.net.www.http.HttpClient.openServer(HttpClient.java:382) at sun.net.www.http.HttpClient.openServer(HttpClient.java:509) at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:278) at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java : 335) at
sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClien.. .
172) at sun.net.www.protocol.http.HttpURLConnection.plainConnect( HttpURLConnection.java: 765) at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect (Abstrac... 158) at sun.net.www.protocol.http.HttpURLConnection.getOutputStream (HttpURLConnection... 857) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream (HttpsURLCon... 230) at com.google.gdata.client.GoogleService.makePostRequest(Unknown Source) ... 2 more ERR: com.google.gdata.util.AuthenticationException: Error connecting with login URI =================================================================
Does this have to do with registering with AuthSub and if so, do I need to do some sort pre-authentication?
I tried to follow the guidelines to posting a new photo from: http://code.google.com/apis/picasaweb/gdata.html but unfortunately, it is unclear about authentication.
Then I looked at:http://code.google.com/apis/gdata/auth.htmland after some more digging, ran to:
http://code.google.com/apis/accounts/AuthForWebApps.html
I do not want to manually enter my credentials as that would render my application useless.
Does anyone know how to upload to Picasa with less pain involved?
Thanks, John




