Hi Tony

My ultimate aim is to get 2 legged oauth working for Google Apps
Domain Administrators, which is not behaving as documented in
http://code.google.com/apis/accounts/docs/OAuth.html#GoogleAppsOAuth

Secondly, I want to use 2 legged oauth to get the list of documents
for all the users in my domain. First of all, is this possible or is
this in beta phase and has not been provided by Google yet? If it is
supported, then can you provide me a sample code which does this?

Thanks

Ajay

On Jan 22, 7:41 am, "Tony (Google)" <[email protected]> wrote:
> Hi Ajay,
>
> There is actually a method for that:
>
> http://code.google.com/apis/apps/gdata_provisioning_api_v2.0_referenc...
>
> You do not need to use OAuth or getting the feed from scratch.
>
> Thanks,
>
> --Tony
>
> On Jan 15, 4:00 am, Ajay <[email protected]> wrote:
>
>
>
> > Hi
>
> > I am using the premier edition and am trying to get the list of users
> > for my domain, I have enabled 2 legged oauth. Here's the code:
> > -----------------------------------------------------------------------
> > import oauth
> > import gdata.apps
> > import gdata.apps.service
> > import urllib
> > import gdata.urlfetch
> > from google.appengine.ext import webapp
> > from google.appengine.ext.webapp.util import run_wsgi_app
> > gdata.service.http_request_handler = gdata.urlfetch
>
> > CONSUMER_KEY = mydomain.com'
> > CONSUMER_SECRET = 'secret_key_for_my_domain'
>
> > USERS_URL = 'https://apps-apis.google.com/a/feeds/domain/user/2.0'
>
> > class OAuthSample(webapp.RequestHandler):
>
> >   def get(self):
> >     consumer = oauth.OAuthConsumer(CONSUMER_KEY, CONSUMER_SECRET)
>
> >     request = oauth.OAuthRequest.from_consumer_and_token(
> >         consumer, http_method='GET', http_url=USERS_URL,
> > parameters=None)
>
> >     request.sign_request(oauth.OAuthSignatureMethod_HMAC_SHA1(),
> > consumer, None)
>
> >     headers = request.to_header()
>
> >     client = gdata.apps.service.AppsService()
>
> >     uri = '%s' % request.http_url
>
> >     feed = client.GetFeed(uri, extra_headers=headers,
> > converter=gdata.apps.UserFeedFromString)
>
> >     for entry in feed.entry:
> >       self.response.out.write('%s, %s<br/>' % (entry.title.text,
> > entry.email[0].address))
>
> > application = webapp.WSGIApplication([('/',
> > OAuthSample)],debug=True)
>
> > def main():
> >    run_wsgi_app(application)
>
> > if __name__ == "__main__":
> >    main()
> > -----------------------------------------------------------------------
>
> > but all am getting is the follwoing error:
>
> > RequestError: {'status': 401, 'body': '<HTML>\n<HEAD>\n<TITLE>Unknown
> > authorization header</TITLE>\n</HEAD>\n<BODY BGCOLOR="#FFFFFF"
> > TEXT="#000000">\n<H1>Unknown authorization header</H1>\n<H2>Error 401</
> > H2>\n</BODY>\n</HTML>\n', 'reason': ''}
>
> > Can you please help me out?
>
> > Thanks
> > Ajay- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Apps APIs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-apps-apis?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to