首先,抱歉我的英语不好。我需要使用tornado.auth在社交网络中编写应用程序授权。但我无法理解tornado.auth文档中的示例如何工作,例如Facebook。
Class FacebookGraphLoginHandler (tornado.web.RequestHandler,
tornado.auth.FacebookGraphMixin):
@ tornado.gen.coroutine
def get (self):
if self.get_argument ( "code", False):
user = yield self.get_authenticated_user (
redirect_uri = '/ auth / facebookgraph /',
client_id = self.settings [ "facebook_api_key"],
client_secret = self.settings [ "facebook_secret"],
code = self.get_argument ( "code"))
# Save the user with e.g. set_secure_cookie
else:
yield self.authorize_redirect (
redirect_uri = '/ auth / facebookgraph /',
client_id = self.settings [ "facebook_api_key"],
extra_params = { "scope": "read_stream, offline_access"})
什么'代码'?从社交网络返回哪种形式的数据?我该如何处理它?如果您也为Google+解释,那会很好,因为您只能从g +获取access_token,我的理解方式。感谢