Tornado Documentation
http://v2ex.xtra.eu.org/tornado/
Tornado on GitHub
https://github.com/facebook/tornado/
Tornado Gists
http://tornadogists.org/
gino
V2EX  ›  Tornado

请教个tornado用sina oauth2登录的问题

  •  
  •   gino · Nov 17, 2012 · 5707 views
    This topic created in 4951 days ago, the information mentioned may be changed or developed.
    我用 https://github.com/lepture/tornado.third/blob/master/weibo.py 做登录

    怎么就死活取不到uid呢,测试下来,好像就没有请求 ACCESS_TOKEN

    希望指点下,谢谢
    2 replies    1970-01-01 08:00:00 +08:00
    gino
        1
    gino  
    OP
       Nov 17, 2012
    class signin_sina(RequestHandler,WeiboMixin):
    @tornado.web.asynchronous
    def get(self):
    next = self.get_argument("next",None)
    state = self.get_argument("state", None)
    redirect_uri = SINA_redirect_uri

    if self.get_argument("code", False):
    self.get_authenticated_user(
    redirect_uri = redirect_uri,
    client_id = SINA_CONSUMER_KEY,
    client_secret = SINA_CONSUMER_SECRET,
    code = self.get_argument("code"),
    callback = self.async_callback(self._on_login,state))
    return
    self.authorize_redirect(
    redirect_uri = redirect_uri,
    client_id = SINA_CONSUMER_KEY,
    extra_params={"response_type": "code","state": next},
    )

    def _on_login(self, user):
    print user
    print 'uuuuu'
    self.finish()


    Handler是这样的,没有任何输出,但是登录sina是成功了
    raptium
        2
    raptium  
       Nov 17, 2012
    callback = self.async_callback(self._on_login,state))

    所以你的 user 就是 state ?
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2608 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 15:53 · PVG 23:53 · LAX 08:53 · JFK 11:53
    ♥ Do have faith in what you're doing.