My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
How_to_use_api_with_oauth  
如何使用支持OAuth的API
Featured, Phase-Deploy
Updated Sep 9, 2010 by gythialy...@gmail.com

API OAuth验证

部署好Jtweet之后,在浏览器中输入地址http(s)://your-appid.appspot.com/api

在出现的页面上,根据自己的情况选择登录方式

  1. OAuth登录:需要登录
  2. OAuth Proxy登录:验证过程中需要twitter的ID和密码,存在安全隐患

如果是自己部署的应用的话,推荐使用OAuth Proxy方式,第三方的请自己判断

OAuth Proxy过程中的登录并验证

验证成功后,会自动生成密码,这时,你在客户端设置好API后,可以直接用twitter ID加此密码登录。如果你后悔的话,可以直接删除验证信息

如果生成的密码比较难记的话,可以在输入新密码后,点击修改按钮进行修改,修改成功后,会显示新的登录信息

至此,你可以用API——http(s)://your-appid.appspot.com/api,twitter ID和你最终获得的密码登录

Comment by yu.zhang...@gmail.com, Sep 12, 2010

我下载了jtweet_r239.zip,使用eclipse部署进GAE后,能访问到欢迎页面,选择OAuth proxy后返回空页面。页面就是个空body,啥也没有。有没有谁遇到这种问题?若有,解决方案如何?

Comment by gue...@gmail.com, Sep 13, 2010

我測試r232 r239 訪問API頁面 都 沒有 OAuth登陆 OAuth Proxy登陆 這兩個選項呢

只有如下的顯示 Jtweet,Twitter API proxy in Java on GAE. This is a Twitter API proxy,and is not intend to be viewed in a browser. Please use https://(這個就不顯示了吧?).appspot.com/api as a Twitter API URI in your Twitter Client.

Comment by project member gythialy...@gmail.com, Sep 14, 2010

后台日志贴出来看看

Comment by yu.zhang...@gmail.com, Sep 14, 2010

有日志倒好定位了,问题就是没日志,error和warn级的都没有。info的倒打了些日志,但是也是正常提示:This request caused a new process to be started for your application, and thus caused your application code to be loaded for the first time. This request may thus take longer and use more CPU than a typical request for your application.

Comment by project member gythialy...@gmail.com, Sep 14, 2010

看了下代码,原因大概是getURLFetchService取回来的页面内容为空或者只是error的提示,程序并未对此做处理。 是每次都出现呢,还是偶尔出现?

Comment by yu.zhang...@gmail.com, Sep 17, 2010

反正我这里是每次出现。我估计是twitter API的问题,可能是请求到达API后,没有得到正确响应。

Comment by Allen.Tsau, Sep 23, 2010

我的也是如此,一直都是空白,gae上也没有发现error或fatal之类日志。

Comment by Allen.Tsau, Oct 10, 2010

API OAuth Proxy后返回时出现500错误 log err: /apicallback org.datanucleus.jdo.exceptions.ClassNotPersistenceCapableException??: The class "The class "jtweet.apiproxy.ApiUser??" is not persistable. This means that it either hasnt been enhanced, or that the enhanced version of the file is not in the CLASSPATH (or is hidden by an unenhanced version), or the Meta-Data/annotations for the class are not found." is not persistable. This means that it either hasnt been enhanced, or that the enhanced version of the file is not in the CLASSPATH (or is hidden by an unenhanced version), or the Meta-Data for the class is not found.

at org.datanucleus.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException(NucleusJDOHelper.java:241) at org.datanucleus.jdo.JDOPersistenceManager.newObjectIdInstance(JDOPersistenceManager.java:1571) at org.datanucleus.jdo.JDOPersistenceManager.getObjectById(JDOPersistenceManager.java:1767) at org.datanucleus.store.appengine.jdo.DatastoreJDOPersistenceManager.getObjectById(DatastoreJDOPersistenceManager.java:73) at jtweet.apiproxy.ApiCallbackServlet??.updateToken(ApiCallbackServlet??.java:97)

而实际上ApiUser??这个类是存在的。

Comment by wingo...@gmail.com, Nov 14, 2010

空body 重设twitter api中的Application Type:选Browser

Comment by alexw...@gmail.com, Mar 19, 2011

r256版本api部分有错误,缺少accessToken = getToken(username);导致下面错误

09:48:49.903 Uncaught exception from servlet java.lang.NullPointerException?? at jtweet.apiproxy.ApiServlet??.generateAuthorizationHeader(ApiServlet??.java:197) at jtw

按照232版本改回去就没问题了


Sign in to add a comment
Powered by Google Project Hosting