RedTea / gtap

Automatically exported from code.google.com/p/gtap
1 stars 2 forks source link

OAuth支持 #9

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
昨晚ep给代码加上了oauth支持,不过现在的身份验证方式比较�
��琐,作者可以考虑改
进一下。

现在的用法是这样的:
1. 注册OAuth,把OAuth的callback url设置为https://xxx.appspot.com/oauth
/twitter/callback
2. 把OAuth的key和secret填入oauth.py
3. 改好app.yaml之后上传到GAE
4. 
访问https://xxx.appspot.com/oauth/twitter/login注册,完成后会显示一�
��key
5. 
设置客户端的api地址为https://xxx.appspot.com/gtap_oauth/,用户名随
意,密
码为(4)显示的key即可登录

我测试过获取/发推/删除推都没问题,不过不确定还有没有其
它bug,请慎用。

(oauth.py原始作者为tav 
(http://github.com/tav/tweetapp/),我作了部分修改)

Original issue reported on code.google.com by SAPika...@gmail.com on 20 Apr 2010 at 3:32

Attachments:

GoogleCodeExporter commented 9 years ago
呃。。。是说找不到函数,你改过oauth.py了?

Original comment by SAPika...@gmail.com on 6 Jun 2010 at 2:39

GoogleCodeExporter commented 9 years ago

打开这个网址https://xxx.appspot.com/gtap_oauth/后这样显示
here is the proxy of "twitter.com" by GTAP 0.2.2_oauth_mod_by_SAPikachu rev.4 !
api建好了,注册好app之后,修改了key,但是没法用啊

Original comment by univer1...@gmail.com on 6 Jun 2010 at 12:30

GoogleCodeExporter commented 9 years ago
于是这个地址是给第三方客户端用的,不能用浏览器直接访��
�

Original comment by SAPika...@gmail.com on 6 Jun 2010 at 12:34

GoogleCodeExporter commented 9 years ago
看这里讨论的还挺热烈,学习中~~我是刚刚把bn的gae加起来就�
��到消息老的验证要停了……不知道twidroid能用这个支
持oauth的api么?

Original comment by moodyn...@gmail.com on 6 Jun 2010 at 3:48

GoogleCodeExporter commented 9 years ago
理论上支持自定义api的客户端都可以支持

Original comment by SAPika...@gmail.com on 7 Jun 2010 at 3:07

GoogleCodeExporter commented 9 years ago
非常感谢!这个是纯客户端代理对吧?非常好,我正在尝试��
�署

Original comment by moodyn...@gmail.com on 7 Jun 2010 at 6:48

GoogleCodeExporter commented 9 years ago
求救……卡在客户端登陆上了:
无论如何也无法登陆上去,很是诡异,显示验证失败,客户��
�twidroid。
URL地址是填带https://头的是吧?
密码就是地4步生成的key是么,类似于id-fc-xxxxxx-xxxx-xxxx-xxxxxx��
�样的?

Original comment by moodyn...@gmail.com on 7 Jun 2010 at 8:59

GoogleCodeExporter commented 9 years ago
应该还是GFW问题,参考 http://code.google.com/p/gtap/issues/detail?id=21

Original comment by SAPika...@gmail.com on 7 Jun 2010 at 9:18

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
果然是这样的……在pc上一直开着proxy没觉得= 
=唉……还是没保证啊这样~只好勤换了=v=
十分感谢SAPikachu:)

Original comment by moodyn...@gmail.com on 7 Jun 2010 at 10:08

GoogleCodeExporter commented 9 years ago
不客气~

Original comment by SAPika...@gmail.com on 7 Jun 2010 at 10:11

GoogleCodeExporter commented 9 years ago
说Key太长的,可以改成自己喜欢的key啊

Original comment by wangguo...@gmail.com on 8 Jun 2010 at 2:20

GoogleCodeExporter commented 9 years ago
你好,我按照说明到第四步的时候,’4. 
访问https://xxx.appspot.com/oauth/twitter/login注册‘点了accept,redirec
t回来还是在twitter页面上,总是在accept。这是怎么回事呢?

Original comment by lzuxz.h...@gmail.com on 8 Jun 2010 at 5:39

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
callback url填了什么呢?另外oauth_config.py贴一下看看?

Original comment by SAPika...@gmail.com on 8 Jun 2010 at 6:05

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
callback url  https://gtaptwit.appspot.com/oauth/twitter/callback
上面贴的那个没有贴全

Original comment by lzuxz.h...@gmail.com on 8 Jun 2010 at 6:24

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
试试把所有代理关掉,然后访问一下 https://gtaptwit.appspot.com/ 
?如果出现连接被重置就是被GFW了,可以参考 
http://code.google.com/p/gtap/issues/detail?id=21 解决

Original comment by SAPika...@gmail.com on 8 Jun 2010 at 9:29

GoogleCodeExporter commented 9 years ago
我下载了gtap-oauth-rev6-2.7z,按照“使用说明”的办法通过sduplo
ad上传,在iphone的tweetie客户端输入api后,显示“could not 
authenticate you (secure connection failed)” 请问哪里有问题?

Original comment by jackicha...@gmail.com on 8 Jun 2010 at 9:34

GoogleCodeExporter commented 9 years ago
应该是被GFW了,参考 http://code.google.com/p/gtap/issues/detail?id=21

Original comment by SAPika...@gmail.com on 8 Jun 2010 at 9:48

GoogleCodeExporter commented 9 years ago
出现这样的问题:

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/fedrik481/1.342521120051028421/oauth.py", line 534, in get
    self.handle(service,action)
  File "/base/data/home/apps/fedrik481/1.342521120051028421/oauth.py", line 549, in handle
    self.response.out.write(getattr(client, action)())
  File "/base/data/home/apps/fedrik481/1.342521120051028421/oauth.py", line 398, in callback
    **dict(token.split('=') for token in token_info.split('&'))
ValueError: dictionary update sequence element #0 has length 4; 2 is required

Original comment by jackicha...@gmail.com on 8 Jun 2010 at 9:55

GoogleCodeExporter commented 9 years ago
访问:https://fedrik481.appspot.com/
得到:
Service is running

Original comment by jackicha...@gmail.com on 8 Jun 2010 at 9:56

GoogleCodeExporter commented 9 years ago
十分奇怪,竟然OK了。顺便问下,这个https://fedrik481.appspot.com/
gtap_oauth/ 对应了一个twitter帐号,别的可以用这个么

Original comment by jackicha...@gmail.com on 8 Jun 2010 at 9:58

GoogleCodeExporter commented 9 years ago
可以用,验证一下就可以了

Original comment by SAPika...@gmail.com on 8 Jun 2010 at 10:07

GoogleCodeExporter commented 9 years ago
请问一下,我直接访问 https://nqoauth.appspot.com 
会撞墙,需要通过代理才能得到“Service is 
running”,这个是怎么回事?

Original comment by smshess on 8 Jun 2010 at 11:57

GoogleCodeExporter commented 9 years ago
被GFW了,参考 http://code.google.com/p/gtap/issues/detail?id=21

Original comment by SAPika...@gmail.com on 8 Jun 2010 at 12:49

GoogleCodeExporter commented 9 years ago
有人了解如何在官方android twitter上用上oauth吗?

Original comment by silently...@gmail.com on 9 Jun 2010 at 10:46

GoogleCodeExporter commented 9 years ago
两位好,我按照两为的教程建立了gae+oauth的api,过程比较顺
利,我在手机客户端中写入自建api后,能够登陆我的twitter用�
��,但是无法收推和发推,提示链接错误,请执教。

Original comment by gesini...@gmail.com on 11 Jun 2010 at 5:37

GoogleCodeExporter commented 9 years ago
目前https访问不正常,app.yaml里改成http从新发布就行了

Original comment by Loo.Yuf...@gmail.com on 11 Jun 2010 at 5:37

GoogleCodeExporter commented 9 years ago
180楼是对的,只要不用https就可以使用。
用上就被墙了。

Original comment by lzuxz.h...@gmail.com on 12 Jun 2010 at 11:23

GoogleCodeExporter commented 9 years ago
感谢!搭好了!很兴奋!用cmwap可连接,用wifi就不行了。有��
�时候出现连接错误,刷不出推。在google app engine里面的error 
log 是“ApplicationError: 5 Traceback (most recent call last): File 
"/base/python_runtime/python_lib/versions/1/google/appengine/ext/webapp/__init__
.py", l ”,请帮忙再分析一下。

Original comment by quad...@gmail.com on 14 Jun 2010 at 3:44

GoogleCodeExporter commented 9 years ago
wifi有时候可以刷出来吧?那应该是网络问题,这个得从网络�
��境找原因了

Original comment by SAPika...@gmail.com on 14 Jun 2010 at 3:51

GoogleCodeExporter commented 9 years ago
我也觉得好奇怪~~反复试了好多次,用之前的google api 
wifi可以,换到现在的gae 就不行了。。

Original comment by quad...@gmail.com on 14 Jun 2010 at 6:25

GoogleCodeExporter commented 9 years ago
呃。。。如果是完全连不上的话,那就是GFW问题了, 
http://code.google.com/p/gtap/issues/detail?id=21

Original comment by SAPika...@gmail.com on 15 Jun 2010 at 1:52

GoogleCodeExporter commented 9 years ago
请问如何注册Oauth啊,注册网址是哪个?Thanks

Original comment by Evan.Li...@gmail.com on 17 Jun 2010 at 4:35

GoogleCodeExporter commented 9 years ago
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/wawj20082008/1.342793401491178561/oauth.py", line 440, in get
    self.handle(service,action)
  File "/base/data/home/apps/wawj20082008/1.342793401491178561/oauth.py", line 455, in handle
    self.response.out.write(getattr(client, action)())
  File "/base/data/home/apps/wawj20082008/1.342793401491178561/oauth.py", line 227, in login
    return self.get_request_token()
  File "/base/data/home/apps/wawj20082008/1.342793401491178561/oauth.py", line 238, in get_request_token
    self.service_info['request_token_url'], **self.request_params
  File "/base/data/home/apps/wawj20082008/1.342793401491178561/oauth.py", line 346, in get_data_from_signed_url
    __url, __token, __meth, **extra_params
  File "/base/data/home/apps/wawj20082008/1.342793401491178561/oauth.py", line 350, in get_signed_url
    return '%s?%s'%(__url, self.get_signed_body(__url, __token, __meth, **extra_params))
  File "/base/data/home/apps/wawj20082008/1.342793401491178561/oauth.py", line 357, in get_signed_body
    'oauth_consumer_key': service_info['consumer_key'],
KeyError: 'consumer_key'

我登陆时,出现这样的提示,网页打不开啊,为啥?有人知��
�吗?谢谢

Original comment by chenlian...@gmail.com on 20 Jun 2010 at 3:43

GoogleCodeExporter commented 9 years ago
呃。。。你修改好oauth_config.py了么?贴一下看看?

Original comment by SAPika...@gmail.com on 20 Jun 2010 at 4:14

GoogleCodeExporter commented 9 years ago
额。。。我一气之下,把GAE删除了,等3天过后再创建GAE试试�
��(

Original comment by chenlian...@gmail.com on 20 Jun 2010 at 4:18

GoogleCodeExporter commented 9 years ago
Comment 186  by Evan.Li915
-----------------------------------
https://twitter.com/apps/

Original comment by SAPika...@gmail.com on 20 Jun 2010 at 4:20

GoogleCodeExporter commented 9 years ago
话说appspot的ip是多少啊。。我改hosts的只有150api请求。。不改
host有2w啊。。白名单ip是多少?

Original comment by Napbonk...@gmail.com on 20 Jun 2010 at 5:28

GoogleCodeExporter commented 9 years ago
于是我刷了很多次,每次的剩余请求都不一样。。。估计发��
�求的ip是随机的,这样也相当于没有限制了

Original comment by SAPika...@gmail.com on 20 Jun 2010 at 6:43

GoogleCodeExporter commented 9 years ago
请问,被墙后如何通过添加hosts文件的方法解决?能详细介绍
一下吗?或者还有没有其他更好的解决办法?谢谢!

Original comment by gengjiec...@gmail.com on 22 Jun 2010 at 3:47

GoogleCodeExporter commented 9 years ago
http://code.google.com/p/gtap/issues/detail?id=21

Original comment by SAPika...@gmail.com on 22 Jun 2010 at 5:12

GoogleCodeExporter commented 9 years ago
@SAPikachu
其实如果不是用在Gravity这样的客户端里,而是网页客户端,�
��以手动强行压缩内容,然后在客户端手动解压
至少我对我的奶瓶腿是这样做的,用bzip2压缩后再base64转码,
再解压转码,还可以避免明文传送的缺点,呵呵

Original comment by ayanamist on 24 Jun 2010 at 2:09

GoogleCodeExporter commented 9 years ago
新版的twitter for iOS,好像不行,报http 
401错误。同一个配置,用别的客户端可以登录。

/gtap_oauth/oauth/access_token 401 210ms 0cpu_ms 0kb Twitter/3.0.1 
CFNetwork/485.2 Darwin/10.3.1,gzip(gfe)
See details

114.86.24.124 - - [24/Jun/2010:08:20:12 -0700] "POST 
/gtap_oauth/oauth/access_token HTTP/1.1" 401 956 - "Twitter/3.0.1 
CFNetwork/485.2 Darwin/10.3.1,gzip(gfe)"

Original comment by ray.c...@live.com on 24 Jun 2010 at 3:25

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Comment 195  by ayanamist
----------------------------
如果是网页中转的话可以直接用https吧(还是说不支持?),
不过可以省空间流量倒是真的

Original comment by SAPika...@gmail.com on 25 Jun 2010 at 12:11

GoogleCodeExporter commented 9 years ago
Comment 196  by ray.c...@live.com
-----------------------------------
看起来是内部直接使用OAuth了,这种情况用gtap-oauth可能会有��
�题,试试用普通版gtap?

Original comment by SAPika...@gmail.com on 25 Jun 2010 at 12:14

GoogleCodeExporter commented 9 years ago
Comment 199  by SAPikachu, Today (2 hours ago)

Comment 196  by ray.c...@live.com
-----------------------------------
看起来是内部直接使用OAuth了,这种情况用gtap-oauth可能会有��
�题,试试用普通版gtap?

_______________________________
不行啊,直接internal server error

Original comment by ray.c...@gmail.com on 25 Jun 2010 at 2:55