The best way to do this may be to write an app that uses
OAuth.  In that way, you can do asynchronous token exchanges
with the caveat that you'll need to pop open a browser window to the
OAuthAuthorizeToken page.  If you don't specify an
oauth_callback url, the user can close the window once they've
authorized the token and exchange the token for an
access token back in your app.

http://code.google.com/apis/accounts/docs/OAuth.html

Eric

On Feb 7, 1:53 pm, kumar <kumaravel.kandas...@gmail.com> wrote:
> Yes, I am using ClientLogin (service.setUserCredentials() method) as
> per the API doc.
>
> So what I am understanding  is that ClientLogin is Not designed to be
> used in an regular 'Browser' client application, because it uses
> XMLHttp Request transport behind the scenes and this determination is
> done by Javascript Environment. So the only option is to use the
> AuthSub authentication.
>
> My primary intentions of using the Javascript API is use in multiple
> different smart phone browsers (above code did not run on Android -
> 404 Error), and remove the server dependency. Said that, Could I use
> ClientLogin authentication using the smart phone platform api and
> determine the 'Auth' token. And then pass on to the Javascript API for
> further gdata feed access ?  Like is there a way to set the auth token
> using the JS API ?
>
> I appreciate your time. Thank You.
>
> On Feb 7, 2:32 pm, "Eric (Google)" <api.e...@google.com> wrote:
>
> > The JavaScript client supports ClientLogin.  In order to enable it,
> > you should use the
> > setUserCredentials method on 
> > GoogleService:http://code.google.com/apis/gdata/jsdoc/1.7/google/gdata/client/Googl...
>
> > However, ClientLogin requires the ability to make cross-domain
> > xmlhttprequests
> > (similar to how this is allowed in FF extensions, google desktop,
> > and most non-browser javascript environments).  Choosing the
> > xmlhttprequest transport
> > happens behind the scenes, and it depends on how the JavaScript client
> > detects the
> > environment its running in.  If you're in the browser, it's likely
> > that AuthSub is your only option.
>
> > Eric
>
> > On Feb 7, 12:17 pm, kumar <kumaravel.kandas...@gmail.com> wrote:
>
> > > Thank you for your suggestion very helpful.
>
> > > However I get a following error when I use Client Login Authentication
> > > model, any suggestions.
>
> > > Error:Access to restricted URI denied
>
> > > CODE:
>
> > > (Following is the full source code... I have changed my developer key
> > > and password in the user credential.)
>
> > > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
> > > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
> > > <html xmlns="http://www.w3.org/1999/xhtml";>
> > >     <head>
> > >         <meta http-equiv="content-type" content="application/x-www-
> > > form-urlencoded"/>
> > >         <title>My Google Data API Application</title>
> > >         <script src="http://www.google.com/jsapi?key=ABQ...";
> > > type="text/javascript"></script>
> > >   <script type="text/javascript">
> > > google.load('gdata', '1.x');
> > > google.setOnLoadCallback(initialize);
>
> > > function initialize() {
> > >     //alert ('inside.');
> > >     var scope = 'http://docs.google.com/feeds/documents/private/full';
> > >     var service = new google.gdata.client.GoogleService('writely',
> > > 'DocList-App-v1.0');
> > >     service.setUserCredentials("kumaravel.kandas...@gmail.com",
> > > "xxx");
> > >     service.getFeed(scope, handleFeed, handleError);
> > >     //alert('outside');
>
> > > };
>
> > > var handleFeed = function(response) {
> > >   var entries = response.feed.entry;
> > >   if (!entries.length) {
> > >     alert('You have no entries!');
> > >     return;
> > >   }
> > >   var html = [];
> > >   for (var i = 0, entry; entry = entries[i]; i++) {
> > >     var title = entry.title.$t;
> > >     html.push('<li>' + title + '</li>');
> > >   }
> > >   document.getElementById('data').innerHTML = html.join('');
>
> > > };
>
> > > var handleError = function(e) {
>
> > >   if (e && e.cause)  {
> > >       alert ('Error:' + e.cause.statusText);
> > >   } else if (e) {
> > >       alert('Error:' + e.message);
> > >   } else {
> > >       alert ('Error:');
> > >   }
>
> > > };
>
> > > </script>
> > >  </head>
> > >     <body>
>
> > > <div id="data"><!-- dynamically filled --></div>
> > >     </body>
> > > </html>
>
> > > On Feb 6, 12:22 pm, "Eric (Google)" <api.e...@google.com> wrote:
>
> > > > I posted a tip here that may get you 
> > > > started:http://gdatatips.blogspot.com/2008/12/using-javascript-client-library...
>
> > > > Eric
>
> > > > On Feb 6, 8:26 am, kumar <kumaravel.kandas...@gmail.com> wrote:
>
> > > > > I planning to use GData Spreadsheets Service using Javascript API, for
> > > > > which there is no API's provided.
>
> > > > > As anyone tried this and succeeded ?
>
> > > > > Example:
> > > > > myService = new GoogleService('wise','exampleCo-exampleApp-1');
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Data Protocol" group.
To post to this group, send email to google-help-dataapi@googlegroups.com
To unsubscribe from this group, send email to 
google-help-dataapi+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-help-dataapi?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to