Oauth Aeoid Python Google App Engine Google文档

Oauth Aeoid Python Google App Engine Google文档,第1张

概述我正在尝试在Google App Engine中为我的学校报纸完成一个故事分配系统.它将追踪作家的截止日期,允许作家收集故事,并对周故事进行“一目了然”的观察.我和我的合作伙伴正试图将它与我们的报纸Google Apps安装完全整合.哦,我们必须使用3条腿的Oauth,因为我们没有Google Apps Premier.在那次努力中,我偶然发现了Aeoid并

我正在尝试在Google App Engine中为我的学校报纸完成一个故事分配系统.它将追踪作家的截止日期,允许作家收集故事,并对周故事进行“一目了然”的观察.我和我的合作伙伴正试图将它与我们的报纸Google Apps安装完全整合.哦,我们必须使用3条腿的Oauth,因为我们没有Google Apps PremIEr.

在那次努力中,我偶然发现了AeoID并且能够按照说明进行联合登录工作.这很酷!

我遇到麻烦的地方是使用Oauth获取用户谷歌文档的列表.我在这里设置了一个测试页面:mustrun.cornellsun.com/test.它给了我错误 – 我已经将它们复制到这封邮件的底部.我不知道这是否与我的消费者秘密有关(我应该使用从谷歌市场获得的密钥?还是应该使用我从管理域页面获得的密钥?).现在我正在使用我从管理域页面获得的密钥

同样复杂的是,实际的appspot域是mustrun2sun [] .appspot [太新了不能发布多个链接] .com,但我在Google应用程序中设置它,以便只有来自我的域的用户才能登录以便应用程序部署在我的域上. (应用程序部署为必须[]运行[].corn [] ellsun [].[] com&所有内容都指向它,即使在管理域中也是如此.)

我正在使用GDClIEnt 2.0类,所以我很确定一切都应该按计划运行…即我没有使用旧的服务或任何东西.我用了[] p:/ [] / k [] ing [] yo-bachi.blog [] spot.c [] om / 2010/05 / gaego [] ogleoauth.ht [] ml作为一点点我的Oauth“舞蹈”的模板,因为谷歌的例子已经过时了使用旧的Google数据1.0库 – 我想.

我进入测试页面时遇到的错误是

Traceback (most recent call last):  file "/base/python_runtime/python_lib/versions/1/Google/appengine/ext/webapp/__init__.py",line 511,in __call__    handler.get(*groups)  file "/base/data/home/apps/mustrun2sun/1.341947133742569880/main.py",line 170,in get    Feed = clIEnt.GetDocList(auth_token=gdata.gauth.AeLoad(users.get_current_user().user_ID())) #auth_token=TOKEN  file "/base/data/home/apps/mustrun2sun/1.341947133742569880/gdata/docs/clIEnt.py",line 141,in get_docList    auth_token=auth_token,**kwargs)  file "/base/data/home/apps/mustrun2sun/1.341947133742569880/gdata/clIEnt.py",line 635,in get_Feed    **kwargs)  file "/base/data/home/apps/mustrun2sun/1.341947133742569880/gdata/clIEnt.py",line 308,in request    response,Unauthorized)Unauthorized: Unauthorized - Server responded with: 401,

此外,由于这对任何源代码都很难,下面是相关代码:

import gdata.authimport gdata.gauthimport gdata.docs.clIEntimport gdata.docs.dataimport gdata.docs.serviceimport gdata.alt.appenginefrom aeoID import mIDdleware,usersclass GetoauthToken(webapp.RequestHandler):    def get(self):        user_ID = users.get_current_user().user_ID()        saved_request_token = gdata.gauth.AeLoad("tmp_"+user_ID)        gdata.gauth.AeDelete ("tmp_" + user_ID)        request_token = gdata.gauth.AuthorizeRequestToken(saved_request_token,self.request.uri)        #upgrade the token        access_token = clIEnt.GetAccesstoken(request_token)        #save the upgraded token        gdata.gauth.AeSave(access_token,user_ID)        self.redirect('/test')     class Test(webapp.RequestHandler):    def get(self):        TOKEN = gdata.gauth.AeLoad(users.get_current_user().user_ID())        if TOKEN:            clIEnt = gdata.docs.clIEnt.DocsClIEnt(source=SETTINGS['APP_name'])            clIEnt.auth_token = gdata.gauth.AeLoad(users.get_current_user().user_ID()) #Could try to put back as TOKEN?            self.response.out.write('moo baby')            clIEnt.ssl = True            Feed = clIEnt.GetDocList(auth_token=gdata.gauth.AeLoad(users.get_current_user().user_ID())) #auth_token=TOKEN            self.response.out.write(Feed)            self.response.out.write('moo boobob')            self.response.headers['Content-Type'] = 'text/plain'            for entry in Feed.entry:                self.response.out.writeln(entry.Title.text)        else:            # Get unauthorized request token            gdata.gauth.AeDelete(users.get_current_user().user_ID())            clIEnt = gdata.docs.clIEnt.DocsClIEnt(source=SETTINGS['APP_name'])            clIEnt.ssl = True # Force communication through httpS            oauth_callback_url = ('http://%s/get_oauth_token' %                                  self.request.host)            request_token = clIEnt.GetoAuthToken(                SETTINGS['ScopES'],oauth_callback_url,SETTINGS['CONSUMER_KEY'],consumer_secret=SETTINGS['CONSUMER_SECRET'])            gdata.gauth.AeSave(request_token,"tmp_"+users.get_current_user().user_ID())            # Authorize request token            domain = None#'cornellsun.com'            self.redirect(str(request_token.generate_authorization_url(Google_apps_domain=domain)))

我一直在网上寻找答案&我找不到一个.最佳答案我有一个工作的python App Engine应用程序,它使用OpenID和OAuth来获取你的谷歌联系人:

http://github.com/sje397/Chess

它运行于:

http://your-move.appspot.com

请注意,由于App Engine支持built-in OpenID,因此不再需要AeoID. 总结

以上是内存溢出为你收集整理的Oauth Aeoid Python Google App Engine Google文档全部内容,希望文章能够帮你解决Oauth Aeoid Python Google App Engine Google文档所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://www.54852.com/langs/1205864.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-06-04
下一篇2022-06-04

发表评论

登录后才能评论

评论列表(0条)