I want to use data.photos.service.PhotosService to pop photos from Picasa. I got the service key file XXXXXXXX-privatekey.p12 from the Google console, and now I'm trying to authenticate using the specified key using google.
The documentation for OAUTH2 using appengine led me to think that using the following would be useful:
f = file(settings.SITE_ROOT + '/aurora/' + settings.PRIVATE_KEY, 'rb') key = f.read() f.close() credentials = SignedJwtAssertionCredentials(settings.SERVICE_ACCOUNT_NAME, key, scope = 'http://picasaweb.google.com/data https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile') http = httplib2.Http() http = credentials.authorize(http) service = build("oauth2", "v2", http=http) user_info = None try: user_info = service.userinfo().get().execute() # neither of these two methods work #gd_client.SetOAuthInputParameters(signature_method = gdata.auth.OAuthSignatureMethod.RSA_SHA1, consumer_key = "asdfasdfasdf.apps.googleusercontent.com", rsa_key = key, two_legged_oauth = True, requestor_id = user_info.get('email')) #gd_client.auth_token = gdata.gauth.TwoLeggedOAuthRsaToken(consumer_key = user_info.get('email'), rsa_private_key = key, requestor_id = user_info.get('email')) except errors.HttpError, e: logging.error('An error occurred: %s', e) user_inf0 = {u'verified_email': True, u'id': u'1234', u'name': u'asdfasdfasdf@developer.gserviceaccount.com', u'email': u'asdfasdfasdf@developer.gserviceaccount.com'}
The problem is that either method 1 returns an invalid token using SetOAuthInputParameters , or method 2 returns 403 restricted .
I am at the end of my mind, looking through the mountains of code that everyone makes regular with 3 legs, when I really and really don't want to do this. Any ideas / articles I haven't seen yet?
Nielsvh
source share